Go to the documentation of this file.00001
00013 #ifndef SHELLUTILS_H
00014 #define SHELLUTILS_H
00015
00016
00017 #include <limits.h>
00018 #include <stdbool.h>
00019 #include <sys/types.h>
00020
00021
00023 #if (defined ARG_MAX && ARG_MAX <= 1048576)
00024 #define MAX_CMDLINE_LEN ARG_MAX
00025 #else
00026 #define MAX_CMDLINE_LEN 1048576
00027 #endif
00028
00029
00031 typedef enum {
00032 PS_RUNNING,
00033 PS_STOPPED,
00034 PS_TERMINATED
00035 } ProcState;
00036
00038 typedef struct {
00039 pid_t pid;
00040 char *cmdLine;
00041 bool background;
00042 ProcState state;
00043 } ProcInfo;
00044
00046 typedef struct {
00047 char *inFile;
00049 char *outFile;
00051 bool background;
00053 const char *parseError;
00056 char *cmdLine;
00058 char **argv;
00060 } ShCommand;
00061
00062
00069 void shPrompt(void);
00070
00102 ShCommand *shParseCmdLine(char cmdLine[]);
00103
00125 int shPrintProcState(const ProcInfo *info);
00126
00127
00128 #endif