From f3d03e71ede8e94e7137777ab5ad5570c3d11b31 Mon Sep 17 00:00:00 2001 From: iceyrazor Date: Fri, 6 Mar 2026 22:34:50 -0600 Subject: some cleanup and shell var - SHELL is now set - cwd now has realloc - realloc with error checking is now a fucntion like malloce --- src/lsh_main_func.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/lsh_main_func.c') diff --git a/src/lsh_main_func.c b/src/lsh_main_func.c index 52c016b..ea2729d 100644 --- a/src/lsh_main_func.c +++ b/src/lsh_main_func.c @@ -36,11 +36,7 @@ char *lsh_read_line(void) // If we have exceeded the buffer, reallocate. if (position >= bufsize) { bufsize += LSH_RL_BUFSIZE; - buffer = realloc(buffer, bufsize); - if (!buffer) { - fprintf(stderr, "lsh: allocation error\n"); - exit(EXIT_FAILURE); - } + buffer = realloce(buffer, bufsize); } } } @@ -160,11 +156,7 @@ CMD **lsh_split_command(char *line) if (position * bufsize >= bufsize) { bufsize += sizeof(CMD*); - tokens = realloc(tokens, bufsize); - if (!tokens) { - fprintf(stderr, "lsh: allocation error\n"); - exit(EXIT_FAILURE); - } + tokens = realloce(tokens, bufsize); } // do not make Redirect or Append a actual command to run -- cgit v1.3