#ifndef H_CMD_EXEC
#define H_CMD_EXEC
#include <stdbool.h>
#include <stdio.h>
#include "sish.h"
#define M_TRUNC 0
#define M_APPEND 1
/* Also completely arbitrary, but you can have at most a shell special char
* after each command, so this seemed reasonable */
#define MAX_COMMANDS (MAX_ARGS / 2)
typedef struct
{
char cmd_and_args[BUFSIZ];
char* redir_stdin; /* NULL by default */
char* redir_stdout; /* " " " "*/
int redir_out_mode;
} Command;
typedef struct
{
Command commands[MAX_COMMANDS];
int num_commands;
bool run_in_background;
/* below are somewhat redundant when considering the above, but they act as
* a sort of temporary storage for parsing where they (the pointers and
* such) then get reassigned later and I really just do not want to deal
* with more mallocing shenanigans than I already do (I could've also
* declared them static in parse_commandline but I don't want to spend time
* debugging the implications / complications that would more than likely
* come from that). It's not pretty but it works and there is *a* reason for
* it, is what I am trying to convey */
char* infile;
char* outfile;
bool append;
} CMD_Pipeline;
void run_commands(char** token_args);
#endif