blob: 3f2bba699431e613f151d71c35876256fe3b8317 (
plain) (
blame)
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
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;
}
|