#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);
|
|
}
|