00001
00007
00008
00009 #include <kernel.h>
00010 #include <shell.h>
00011 #include <stdio.h>
00012 #include <string.h>
00013
00023 command xsh_exit(ushort stdin, ushort stdout, ushort stderr,
00024 ushort nargs, char *args[])
00025 {
00026
00027 if (nargs == 2 && strncmp(args[1],"--help",6) == 0)
00028 {
00029 fprintf(stdout, "Usage: exit\n");
00030 fprintf(stdout, "Closes the XINU shell.\n");
00031 fprintf(stdout, "\t--help\t display this help and exit\n");
00032 return SYSERR;
00033 }
00034
00035
00036 if (nargs > 1)
00037 {
00038 fprintf(stderr, "exit: too many arguments\n");
00039 fprintf(stderr, "Try 'exit --help' for more information.\n");
00040 return SYSERR;
00041 }
00042
00043 fprintf(stdout, SHELL_EXIT);
00044 sleep(10);
00045 kill(getpid());
00046
00047 return OK;
00048 }