blob: 5697352a39e4a7de01fdef849745545c3f3bcb4a (
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
36
37
38
|
#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 initFiles();
extern void registerDefaultHandlers();
extern bool route(char *command);
void printDefault();
int main() {
initFiles();
registerDefaultHandlers();
char buffer[LINE_MAX];
buffer[0] = 0;
printf("Welcome!\n\n");
do {
// Removes the Line Feed character at the "end", if it exists
char *p_toChange = strchr(buffer, 0x0A);
if (p_toChange != NULL)
p_toChange[0] = 0;
if (buffer[0] > 0)
if (route(buffer))
printf("\n");
printf(SHELL_STRING);
} while (fgets(buffer, LINE_MAX, stdin));
return 0;
}
|