void execute_command(command_t c, int profiling) { switch (c->type) { case IF_COMMAND: execute_if(c, profiling); break; case UNTIL_COMMAND: execute_until(c, profiling); break; case WHILE_COMMAND: execute_while(c, profiling); break; case SEQUENCE_COMMAND: execute_sequence(c, profiling); break; case PIPE_COMMAND: execute_pipe(c, profiling); break; case SIMPLE_COMMAND: execute_simple(c, profiling); break; case SUBSHELL_COMMAND: execute_subshell(c, profiling); break; default: error (1, 0, "command not found"); } }
void execute_command (command_t c, bool time_travel) { char cmd_type = ' '; switch(c->type) { case SIMPLE_COMMAND: execute_simple(c); cmd_type = 's'; break; case SUBSHELL_COMMAND: execute_subshell(c, time_travel); cmd_type = '('; break; case AND_COMMAND: execute_and(c, time_travel); cmd_type = 'a'; break; case OR_COMMAND: execute_or(c, time_travel); cmd_type = 'o'; break; case SEQUENCE_COMMAND: execute_sequence(c, time_travel); cmd_type = ';'; break; case PIPE_COMMAND: execute_pipe(c, time_travel); cmd_type = '|'; break; default: return; } if (DEBUG) { printf("%c cmd - exit status: %d\n", cmd_type, c->status); } }