diff options
| author | Ákos Kőrösi <korakos99@gmail.com> | 2026-05-19 21:13:19 +0200 |
|---|---|---|
| committer | Ákos Kőrösi <korakos99@gmail.com> | 2026-05-19 21:13:19 +0200 |
| commit | 2bdbf387261285d07e4b62d1e23c9e43efb14604 (patch) | |
| tree | 92b81d300f3c17d072f2a30362dafd815e57a758 /src/main.c | |
| parent | 6a391a1180766ac5717c40efa70d46cacca83f91 (diff) | |
restructure dir, create makefile
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..35c2bff --- /dev/null +++ b/src/main.c @@ -0,0 +1,23 @@ +#include <stdlib.h> +#include <stdio.h> +#include <readline/readline.h> +#include <readline/history.h> +#include <string.h> + +#include "exec.h" + + +int main() { + char* line; + ShellState shstate = {.shell_vars = make_KeyValMap(1), .aliases = make_KeyValMap(1)}; + while (1) { + line = readline("$ "); + if (line[0] == '\0') continue; + if (strcmp(line, "exit") == 0) exit(0); + add_history(line); + process_input_line(line, &shstate); + } + free(line); +} + + |
