diff options
| author | nasrlol <nsrddyn@gmail.com> | 2025-02-08 17:04:49 +0100 |
|---|---|---|
| committer | nasrlol <nsrddyn@gmail.com> | 2025-02-08 17:04:49 +0100 |
| commit | e838beaad2ba3c5ca1dc307e9abf5b4f88e53843 (patch) | |
| tree | 4f873768ee67cec6eec31fc4b43ea12699f488a7 /main.c | |
| parent | 361cfbe3f804502f42fdbacc15e88adb42baece1 (diff) | |
exit is working now
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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; |
