summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--02_exercise/shell.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/02_exercise/shell.c b/02_exercise/shell.c
index 84f8aff..f48819b 100644
--- a/02_exercise/shell.c
+++ b/02_exercise/shell.c
@@ -34,23 +34,13 @@ int main(int argc, char* argv[]) {
size_t argument_count;
parse_line(line, &exe, &arguments, &argument_count);
- for (size_t h = 0; h < argument_count; ++h) {
- char *part;
- part = arrayPop(arguments);
- if (part == NULL)
- continue;
- printf("%s\n", part);
- }
-
- exit(0);
-
if (strcmp(exe, "cd") == 0) {
printf("Changing dirs \n");
chdir("beispiele");
} else if (strcmp(exe, "exit") == 0) {
exit(0);
} else {
- exec_command(exe, (char *const []) {exe, NULL}, 0);
+ exec_command(exe, arguments, 0);
}
free((void *)line);
// no need to free exe, since it is part of arguments any way
@@ -81,7 +71,6 @@ int parse_line(char const *line, char **exe, char ***parts, size_t *part_count)
strcpy(*exe, part);
found_exe = true;
}
- arrayRelease(part); // TODO: am i supposed/allowed to free it here?
arrayInit(part);
if (c == '\0') {
arrayPush(local_parts) = NULL;