diff --git a/src/builtins.c b/src/builtins.c index bb70815..a677774 100644 --- a/src/builtins.c +++ b/src/builtins.c @@ -37,19 +37,19 @@ bool is_builtin(char *command) { /** * Run the builtin command. - * @param string_array An array of strings containing the arguments to run. + * @param args An array of strings containing the arguments to run. */ -void run_builtin(StringArray *string_array) { - if (strcmp(string_array->array[0], "exit") == 0) { - exit_shell(string_array); +void run_builtin(StringArray *args) { + if (strcmp(args->array[0], "exit") == 0) { + exit_shell(args); } } /** * Exit the shell. - * @param string_array The arguments that were used to call exit. This is used to free the memory before exit. + * @param args The arguments that were used to call exit. This is used to free the memory before exit. */ -void exit_shell(StringArray *string_array) { - free_string_array(string_array); +void exit_shell(StringArray *args) { + free_string_array(args); exit(EXIT_SUCCESS); } diff --git a/src/loop.c b/src/loop.c index 23953bc..6721ec3 100644 --- a/src/loop.c +++ b/src/loop.c @@ -40,13 +40,13 @@ void loop() { remove_new_line(line); - StringArray string_array; - create_string_array(&string_array); + StringArray args; + create_string_array(&args); char *saveptr = NULL; char *token = strtok_r(line, " ", &saveptr); while (token) { - insert_string_array(&string_array, token); + insert_string_array(&args, token); token = strtok_r(NULL, " ", &saveptr); } if (line != NULL) { @@ -55,14 +55,14 @@ void loop() { } // The user didn't type anything so restart the loop - if (string_array.size == 0) { + if (args.size == 0) { continue; } - if (is_builtin(string_array.array[0])) { - run_builtin(&string_array); + if (is_builtin(args.array[0])) { + run_builtin(&args); } - free_string_array(&string_array); + free_string_array(&args); } }