diff options
-rw-r--r-- | 02_exercise/shell.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/02_exercise/shell.c b/02_exercise/shell.c index c960680..1c03961 100644 --- a/02_exercise/shell.c +++ b/02_exercise/shell.c @@ -65,12 +65,10 @@ int parse_line(char const *line, char ***parts, size_t *part_count) { char *part; char **local_parts; - arrayInit(part); - arrayInit(local_parts); -/* if (arrayInit(part) != 0 || arrayInit(local_parts) != 0) { - fprintf(stderr, "Failed to prepare new part array"); - exit(-1); - }*/ + if (arrayInit(part) != 0 || arrayInit(local_parts) != 0) { + fprintf(stderr, "Failed to prepare new part / parts array whilst parsing line"); + return -1; + } char c; int i = 0; @@ -97,8 +95,8 @@ int parse_line(char const *line, char ***parts, size_t *part_count) { } void print_prompt() { - size_t length = 1024; - char *buffer = malloc(length * sizeof(char)); + size_t length = 1024; + char *buffer = malloc(length * sizeof(char)); getcwd(buffer, length); if (buffer == NULL) { printf(".> "); |