diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-09-02 08:45:47 +0300 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-09-02 08:45:47 +0300 |
| commit | 6a36d7e889fb3b683c03607428ad88cd5fadaceb (patch) | |
| tree | dbad26ce67228334603c808ca5ed6e062fda1e23 /src/main.c | |
| parent | 124e07eb3d22e3964f1fcd2580d7f2954621c596 (diff) | |
| download | you86-6a36d7e889fb3b683c03607428ad88cd5fadaceb.tar you86-6a36d7e889fb3b683c03607428ad88cd5fadaceb.tar.gz you86-6a36d7e889fb3b683c03607428ad88cd5fadaceb.zip | |
(1) Moved code files to src folder
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..3f2bba6 --- /dev/null +++ b/src/main.c @@ -0,0 +1,35 @@ +#include <bits/posix2_lim.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <limits.h> +#include <string.h> + +#define SHELL_STRING "> " + +extern void registerDefaultHandlers(); +void printDefault(); +extern bool route(char *command); + +int main() { + char buffer[LINE_MAX]; + buffer[0] = 0; + + registerDefaultHandlers(); + + printf("Welcome!\n\n"); + do { + // Removes the Line Feed character at the "end", if it exists + char *toChange = strchr(buffer, 0x0A); + if (toChange != NULL) + toChange[0] = 0; + + if (buffer[0] > 0) + if (route(buffer)) + printf("\n"); + + printf(SHELL_STRING); + } while (fgets(buffer, LINE_MAX, stdin)); + + return 0; +} |
