diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-09-02 08:44:13 +0300 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-09-02 08:44:13 +0300 |
| commit | 740efa6658c17158058f161b0230b7718b6bd051 (patch) | |
| tree | bab8e9c1e8e65dad2428e51a5fa3a410daba1acf /main.c | |
| parent | f5e2da80d26c7ed8381cb31c2fde5aae67269952 (diff) | |
| download | you86-740efa6658c17158058f161b0230b7718b6bd051.tar you86-740efa6658c17158058f161b0230b7718b6bd051.tar.gz you86-740efa6658c17158058f161b0230b7718b6bd051.zip | |
(1) Added current implementations: shell input handling
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -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; +} |
