- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinput.c
More file actions
Latest commit
94 lines (86 loc) · 3.16 KB
/
Copy pathinput.c
File metadata and controls
94 lines (86 loc) · 3.16 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include<stdio.h>
#defineCOLOR_BLACK "\033[0;30m"
#defineCOLOR_RED "\033[0;31m"
#defineCOLOR_GREEN "\033[0;32m"
#defineCOLOR_YELLOW "\033[0;33m"
#defineCOLOR_BLUE "\033[0;34m"
#defineCOLOR_MAGENTA "\033[0;35m"
#defineCOLOR_CYAN "\033[0;36m"
#defineCOLOR_WHITE "\033[0;37m"
#defineBOLD_BLACK "\033[1;30m"
#defineBOLD_RED "\033[1;31m"
#defineBOLD_GREEN "\033[1;32m"
#defineBOLD_YELLOW "\033[1;33m"
#defineBOLD_BLUE "\033[1;34m"
#defineBOLD_MAGENTA "\033[1;35m"
#defineBOLD_CYAN "\033[1;36m"
#defineBOLD_WHITE "\033[1;37m"
#defineINTENSE_BLACK "\033[0;90m"
#defineINTENSE_RED "\033[0;91m"
#defineINTENSE_GREEN "\033[0;92m"
#defineINTENSE_YELLOW "\033[0;93m"
#defineINTENSE_BLUE "\033[0;94m"
#defineINTENSE_MAGENTA "\033[0;95m"
#defineINTENSE_CYAN "\033[0;96m"
#defineINTENSE_WHITE "\033[0;97m"
#defineBOLD_INTENSE_BLACK "\033[1;90m"
#defineBOLD_INTENSE_RED "\033[1;91m"
#defineBOLD_INTENSE_GREEN "\033[1;92m"
#defineBOLD_INTENSE_YELLOW "\033[1;93m"
#defineBOLD_INTENSE_BLUE "\033[1;94m"
#defineBOLD_INTENSE_MAGENTA "\033[1;95m"
#defineBOLD_INTENSE_CYAN "\033[1;96m"
#defineBOLD_INTENSE_WHITE "\033[1;97m"
#defineBG_BLACK "\033[40m"
#defineBG_RED "\033[41m"
#defineBG_GREEN "\033[42m"
#defineBG_YELLOW "\033[43m"
#defineBG_BLUE "\033[44m"
#defineBG_MAGENTA "\033[45m"
#defineBG_CYAN "\033[46m"
#defineBG_WHITE "\033[47m"
#defineBG_INTENSE_BLACK "\033[0;100m"
#defineBG_INTENSE_RED "\033[0;101m"
#defineBG_INTENSE_GREEN "\033[0;102m"
#defineBG_INTENSE_YELLOW "\033[0;103m"
#defineBG_INTENSE_BLUE "\033[0;104m"
#defineBG_INTENSE_MAGENTA "\033[0;105m"
#defineBG_INTENSE_CYAN "\033[0;106m"
#defineBG_INTENSE_WHITE "\033[0;107m"
#defineCOLOR_RESET "\033[0m"
#defineTEXT_UNDERLINE "\033[4m"
#defineTEXT_BLINK "\033[5m"
#defineTEXT_REVERSED "\033[7m"
#defineTEXT_HIDDEN "\033[8m"
#include"types.h"
// Forward declarations to kernel drivers
externvoidserial_print(constchar*str);
externintseparate_command(char*input_string, char**output_tokens);
#defineMAX_TOKENS 16
/**
* @brief Prints custom user prompt to the kernel log/serial output
*/
voidprint_prompt(constchar*user) {
serial_print(user);
serial_print("@kernel > ");
}
/**
* @brief Initializes terminal shell with a custom welcome message
*/
voidterminal_init(constchar*welcome_message, constchar*user) {
serial_print("\033[H\033[J"); // Clear screen via terminal escape code
serial_print(welcome_message);
serial_print("\n");
print_prompt(user);
}
/**
* @brief Handles incoming raw input string inside kernel space
*/
voidrun_terminal_input(char*raw_input, constchar*user) {
char*tokens[MAX_TOKENS];
inttoken_count=separate_command(raw_input, tokens);
if (token_count>0) {
// Command router logic executes here...
}
print_prompt(user);
}