⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sl.c

📁 Unix shell是unix的命令解释程序
💻 C
字号:
#include "_dir.h"#include "_md.h"#include "_time.h"#include "_date.h"#include "_del.h"#include "_ren.h"#include "_find.h"#include "_copy.h"#include "_cd.h"#include "_help.h"#include "_fork.h"#include "_more.h"//#include "datetime.h"#include "_pwd.h"#include<string.h>#include<stdio.h>int main(){	char line[90];	char v1[30],v2[30],v3[30];	char *f;//	for(;;)//	{l:	printf("@");	fgets(line,sizeof(line),stdin);	sscanf(line,"%s%s%s",v1,v2,v3);//	printf("%s\t%s\t%s\n",v1,v2,v3);	int n1;//	char *f;	n1=-1;	if(strcmp(v1,"exit")==0)n1=0;	if(strcmp(v1,"dir")==0)n1=1;	if(strcmp(v1,"pwd")==0)n1=2;	if(strcmp(v1,"md")==0)n1=3;	if(strcmp(v1,"date")==0)n1=4;	if(strcmp(v1,"time")==0)n1=5;	if(strcmp(v1,"del")==0)n1=6;	if(strcmp(v1,"ren")==0)n1=7;	if(strcmp(v1,"find")==0)n1=8;	if(strcmp(v1,"copy")==0)n1=9;	if(strcmp(v1,"cd")==0)n1=10;	if(strcmp(v1,"more")==0)n1=11;	if(strcmp(v1,"help")==0)n1=12;	if(strncmp(v1,"./",2)==0)n1=13;	switch(n1)	{        	case 0:                	return 0;			break;		case 1://			printf("hehe!");			_dir(v2);			break;		case 2:			_pwd();			break;		case 3:			_md(v2);			break;		case 4:			_date();			break;		case 5:			_time();			break;		case 6:			_del(v2);			break;		case 7:			_ren(v2,v3);			break;		case 8:			_find(v2,v3);			break;		case 9:			_copy(v2,v3);			break;		case 10:			_cd(v2);			break;		case 11:			_more(v2);			break;		case 12:			_help();			break;		case 13:	//		printf(v1);//			clrscr();			printf("the length of v1 is :%d\n",strlen(v1));			f=strtok(strtok(v1,"."),"/");		//	strtok(NULL,"/");			printf("%s\n",f);	//		strtok(NULL,".");			_fork(f,v2,v3);			break;		default:			printf("command not found.\n");			break;	}	goto l;	//	}//	if(n1==1)printf("fuck!");//	else printf("fuck too!");        return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -