diff --git a/Main.c b/Main.c index 62c7ea3e4666480ab6c4766d1570310f823db5d2..247e65ef1b75dce79533192f2f3ef18745e09b77 100644 --- a/Main.c +++ b/Main.c @@ -110,12 +110,9 @@ int main(int argc, char* argv[]) { printf(ANSI_COLOR_BLUE "%s$ " ANSI_COLOR_RESET, current_directory); user_input = get_user_input_with_prompt(""); free(current_directory); - parse_line(user_input); - printf("Tokens: %d\n", line_argv->argc); - printf("line_argv->argv: %s\n", **line_argv->argv); - + // Make sure at least one command is present. if (line_argv->argc > 0) { parse_command(); @@ -181,8 +178,6 @@ int main(int argc, char* argv[]) { * Parses given line into subsections, separated by pipes. */ void parse_line(char* command_line) { - // Parse line into struct. Seperates by each found "|" in argument. - // Each seperated value should be an individual commmand. line_argv = calloc(1, sizeof(makeargv_struct)); line_argv->argv = calloc(1, sizeof(char***)); line_argv->argc = makeargv(command_line, "|", line_argv->argv); @@ -204,14 +199,8 @@ void parse_command() { command_argv = calloc(line_argv->argc, sizeof(makeargv_struct)); temp_pointer = command_argv; - // For each argument in line_argv, parse again. - // This will separate the individual arguments of each given command. index = 0; while (index < line_argv->argc) { - - // Print line argv to prove it exists. - printf("%d | line_argv arg: %s\n", index, (*(*line_argv->argv + index))); - command_argv->argv = calloc(1, sizeof(char***)); command_argv->argc = makeargv((*(*line_argv->argv + index)), " ", command_argv->argv); @@ -219,13 +208,7 @@ void parse_command() { if (command_argv->argc < 0) { err_sys("Unexpected error parsing command line."); } - - // Print same value as above, but in command_argv to prove it exists. - printf("%d | command_argv arg: %s\n", index, (*(*command_argv->argv + 1))); ++command_argv; - - printf("\n"); - index++; } command_argv = temp_pointer; @@ -303,9 +286,6 @@ void recursive_execute(int argc, makeargv_struct* args, int current_arg) { ++temp_pointer; index++; } - - printf("Process to Run: %s\n", **temp_pointer->argv); - execvp(**temp_pointer->argv, *temp_pointer->argv); err_sys("Failed to exec."); }