/*----- main.c --------------------------------*/ #include #include #include #include "defs.h" #include "sign.h" #include "cmd.h" #include "termination.h" #include "gettoken.h" int main() { char * prompt; int pid, status; extern int lastExitStat; TOKEN term; if (( ignoresig(SIGINT) == SIG_ERR) || ( ignoresig(SIGCHLD) == SIG_ERR)) { perror("ignoresig"); exit(1); } prompt = "mysh> "; while (1) { printf("%s", prompt); do { term = command(&pid); if ((term != T_AMP) && (pid != 0)) { printf("Waiting for %d.\n", pid); waitpid(pid, &status, 0); } } while (((term == T_AND) && !lastExitStat) || ((term == T_OR) && lastExitStat)); printf("Status of last command: %d.\n", lastExitStat); skip_line(); } printf("\n\n"); exit(0); }