/* Begin definitions from the Weiss text, page 393 */ #include #include #include #include #include #include #include #include #include #include /* Simple Shell */ /* A Simple Command Is An Array Of Up To Maxargc+1 Strings */ /* The Last String Is NULL */ /* This Can Be Used Directly For execvp */ /* Very Limited Error Checking To Keep Code Short */ #define MaxArgc 10 #define MaxPipes 10 #define FileNameLen MaxLineLen #define MaxLineLen 256 typedef char *SimpleCommand[ MaxArgc + 1 ]; typedef struct { char InFile[ FileNameLen ]; char OutFile[ FileNameLen ]; int NumPipes; SimpleCommand Commands[ MaxPipes ]; int BackGround; } FullCommand; enum { Eoln, Error, From, To, Pipe, Word, Amper }; /* Read A Line, return NULL on EOF */ #define GetLine( S ) ( fgets( S, MaxLineLen, stdin ) ) /* End definitions from the Weiss book, page 393 */ enum { UNSET, SET }; /* DO NOT CHANGE ANYTHING ABOVE THIS LINE */ /* Add local definitions that are specific to your project here */ /* Miscellaneous #defines to satisfy lint */ #define printf (void)printf #define fprintf (void)fprintf