diff options
Diffstat (limited to 'include/command.h')
| -rw-r--r-- | include/command.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/include/command.h b/include/command.h new file mode 100644 index 0000000..3df724b --- /dev/null +++ b/include/command.h @@ -0,0 +1,35 @@ +/* + * + */ + +#ifndef H_HUSH_COMMAND +#define H_HUSH_COMMAND + +#include <stdio.h> + +#include "lexer.h" +#include "config.h" + +typedef struct command { + char *command; + char *infile; + char *outfile; + struct command *next; + pid_t pid; + + int pipe[2]; + int *read_pipe; + + char *args[MAX_ARGUMENT_CNT + 2]; +} command; + + +command *commands_from_tokens(token *parsed_cmdstr, size_t *cnt); + +void print_commands(FILE *file, command *cmds); + +void destroy_commands(command *cmds); + +int execute_command(command *cmd); + +#endif |