www.pudn.com > os2design4file.rar > myshell.c


#include"stdio.h"
#include"compare.h"
#include"mydate.h"
#include"mytime.h"
#include"mypwd.h"
#include"mydir.h"
#include"mymd.h"
#include"mydel.h"
#include"myren.h"
#include"mycd.h"
#include"mycopy.h"
#include"myfind.h"
#include"mymore.h"
#include"myfork.h"
int main()
{
	char instr[20];
	char strto[3][40]={"","",""};
	printf("Welcome to myshell@:");
	int i=1;
	while(i)
	{
		gets(instr);
		i=compare(instr,strto);
		switch(i)
		{
			case 0:
				{
					printf("ÃüÁî´íÎó!\n");
					printf("Welcome to myshell@:");
					i=20;
					break;
				}
			case 1:
				{
					mydir(strto[1]);
					printf("Welcome to myshell@:");
					break;
				}
			case 2:
				{
					mycd(strto[1]);
					printf("Welcome to myshell@:");
					break;
				}
			case 3:
				{
					mypwd();
					printf("Welcome to myshell@:");
					break;
				}
			case 4:
				{
					mymd(strto[1]);
					printf("Welcome to myshell@:");
					break;
				}
			case 5:
				{
					mycopy(strto[1],strto[2]);
					printf("Welcome to myshell@:");
					break;
				}
			case 6:
				{
					myfind(strto[1],strto[2]);
					printf("Welcome to myshell@:");
					break;
				}
			case 7:
				{
					mymore(strto[1]);
					printf("Welcome to myshell@:");
					break;
				}
			case 8:
				{
					mydate();
					printf("Welcome to myshell@:");
					break;
				}
			case 9:
				{
					mytime();
					printf("Welcome to myshell@:");
					break;
				}
			case 10:
				{
					myren(strto[1],strto[2]);
					printf("Welcome to myshell@:");
					break;
				}
			case 11:
				{
					mydel(strto[1]);
					printf("Welcome to myshell@:");
					break;
				}
			case 12:
				{
					printf("exit\n");
					i=0;
					break;
				}
			case 13:
				{
					myfork(strto[0]);
					printf("Welcome to myshell@:");
					break;
				}
		}
	}
}