summaryrefslogtreecommitdiff
path: root/main.c
blob: ce2d0078035a6ac2ae1ad11b4ac8144a5ca490bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdbool.h>
#include <readline/readline.h>

int main() {
    const bool RUNNING = true;
    char *COMMAND_HISTORY;
    COMMAND_HISTORY = (char *)malloc(sizeof(char));

    // RUNNING THE PROGRAM ON AN ENDLESS LOOP
    // BREAKS WHEN USER ENTERS EXIT
    while(RUNNING) {
        char *TEMP = "";

        scanf("%s", &TEMP);
        for (int i = 0; (TEMP + i) != "/0"; i++)
        {
                tolower(TEMP[0]);
        }

        if (TEMP == "exit") {
            printf("exited successfully");
        }
        else {
            strcpy(&TEMP, (COMMAND_HISTORY));
            printf("%s",COMMAND_HISTORY);
        }

    }
    return 0;
}