diff options
| author | Soikk | 2022-08-13 18:49:30 +0200 |
|---|---|---|
| committer | Soikk | 2022-08-13 18:49:30 +0200 |
| commit | 4b721332d570f53719894af922c22b7cba146b18 (patch) | |
| tree | 9c5b8f75345310cd7f2479fca0ebaf20c7ca47dc /src/repl.c | |
| parent | 32dd785f881cf3ba6c1c6806cd3af3cbf56437c4 (diff) | |
| download | soikk-DB-4b721332d570f53719894af922c22b7cba146b18.tar.xz soikk-DB-4b721332d570f53719894af922c22b7cba146b18.tar.zst | |
Added primitive repl, delete functions for database and remove tag from file function.
Diffstat (limited to 'src/repl.c')
| -rw-r--r-- | src/repl.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -5,7 +5,6 @@ inputBuffer *newInputBuffer(void){ inputBuffer *in = malloc(sizeof(inputBuffer)); in->buffer = NULL; in->inputSize = 0; - return in; } @@ -18,13 +17,17 @@ void getInput(inputBuffer *in){ size_t n; ssize_t r = getline(&(in->buffer), &n, stdin); if(r <= 0){ - printf("Error\n"); + fprintf(stderr, "Error\n"); exit(r); } in->inputSize = r-1; in->buffer[in->inputSize] = 0; } -void prompt(void){ - printf("db > "); -}
\ No newline at end of file +void prompt(database *db){ + if(db == NULL){ + printf("db > "); + }else{ + printf("%s > ", db->name); + } +} |
