aboutsummaryrefslogtreecommitdiff
path: root/src/lsh_main_func.c
diff options
context:
space:
mode:
authoriceyrazor <iceyrazor@mailfence.com>2026-03-06 22:34:50 -0600
committericeyrazor <iceyrazor@mailfence.com>2026-03-06 22:34:50 -0600
commitf3d03e71ede8e94e7137777ab5ad5570c3d11b31 (patch)
treeddd17a5e3e1c40e645772cb9466169b98389985d /src/lsh_main_func.c
parent5964950ca5c018e1163fe308fa4bb17b9220b383 (diff)
some cleanup and shell var
- SHELL is now set - cwd now has realloc - realloc with error checking is now a fucntion like malloce
Diffstat (limited to 'src/lsh_main_func.c')
-rw-r--r--src/lsh_main_func.c12
1 files changed, 2 insertions, 10 deletions
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