You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
559 B

#include <stdio.h>
#include <stdlib.h>
#include "fun.h"
char *getcwd(char *buf,size_t size);
int main()
{
char cmdline[MAXLINE];
main_proc_pid = getpid();
char pwd[64];
signal(SIGINT, sigint_handler);
while(1)
{
getcwd(pwd, 64);
printf("[root@yueshell %s]# ",pwd);
//printf("COMMAND->");
fflush(stdin);
fgets(cmdline, MAXLINE, stdin);
eval(cmdline);
history(cmdline);
}
return 0;
}
void sigint_handler()
{
printf("\nWarning : shell exit!!\n");
exit(0);
}