diff options
Diffstat (limited to 'cmd.h')
-rw-r--r-- | cmd.h | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -0,0 +1,30 @@ | |||
1 | #ifndef CMD_H | ||
2 | #define CMD_H | ||
3 | |||
4 | #include <stdbool.h> | ||
5 | #include <stdio.h> | ||
6 | #include <stdlib.h> | ||
7 | |||
8 | typedef enum { | ||
9 | CMD_TYPE_NORMAL, | ||
10 | CMD_TYPE_PIPE, | ||
11 | CMD_TYPE_AND, | ||
12 | CMD_TYPE_OR, | ||
13 | // add more command types as needed | ||
14 | } CommandType; | ||
15 | |||
16 | typedef struct Command { | ||
17 | CommandType type; // the type of the command | ||
18 | char **args; // an array of strings for the arguments of the command | ||
19 | struct Command *left; // a pointer to the left sub-command | ||
20 | struct Command *right; // a pointer to the right sub-command | ||
21 | char *redirect_in; // the file name for input redirection, or NULL if there | ||
22 | // is no input redirection | ||
23 | char *redirect_out; // the file name for output redirection, or NULL if | ||
24 | // there is no output redirection | ||
25 | char *append_out; // the file name for output appending, or NULL if there is | ||
26 | // no output appending | ||
27 | // add more fields as needed | ||
28 | } Command; | ||
29 | |||
30 | #endif \ No newline at end of file | ||