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