From e838beaad2ba3c5ca1dc307e9abf5b4f88e53843 Mon Sep 17 00:00:00 2001 From: nasrlol Date: Sat, 8 Feb 2025 17:04:49 +0100 Subject: exit is working now --- main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 65904b9..79e8105 100644 --- a/main.c +++ b/main.c @@ -21,12 +21,9 @@ static char *COMMAND_HISTORY[MAX_HISTORY] = { NULL}; // DEFAULT SHELL COMMANDS // exit() command -void exit_program(char *argv) +void exit_program() { - if (strcmp(argv, "exit")) - { exit(0); - } } // pwd command @@ -97,7 +94,12 @@ int main(void) char *input = malloc(sizeof(char *) * MAX_COMMAND_LENGTH); while (true) { + printf("SHELL> "); scanf("%s", input); + + if (strcmp(input, "exit") == 0) + exit_program(); + } return 0; -- cgit v1.2.3-70-g09d2