diff options
| author | Douglas B. Rumbaugh <doug@douglasrumbaugh.com> | 2025-10-31 23:41:32 -0400 |
|---|---|---|
| committer | Douglas B. Rumbaugh <doug@douglasrumbaugh.com> | 2025-10-31 23:41:32 -0400 |
| commit | 06a02a3a50baf261a0f1c998bfd02269c3ed45de (patch) | |
| tree | 00aa66e09a31b2563221c385e5ac129a57082729 /include/command.h | |
| download | hush-06a02a3a50baf261a0f1c998bfd02269c3ed45de.tar.gz | |
Initial commit
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 |