/* * include/command.h * * Abstractions for parsing commands from tokens and executing them * CISC 301 -- Operating Systems, Project 2 * * Copyright (C) 2025 Douglas B. Rumbaugh * * Distributed under the Modified BSD License * */ #ifndef H_HUSH_COMMAND #define H_HUSH_COMMAND #include #include "lexer.h" #include "config.h" typedef struct command { const char *command; const char *infile; const char *outfile; struct command *next; struct command *prev; pid_t pid; int pipe[2]; const 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