-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminishell.c
More file actions
45 lines (44 loc) · 1.11 KB
/
minishell.c
File metadata and controls
45 lines (44 loc) · 1.11 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
#include <ntddk.h>
#include "utils.h"
void execute_command(char* command)
{
if (my_strcmp(command, "HI") == 0)
{
PrintString("Hello, Native World!\n");
}
else if (my_strcmp(command, "SLEEP") == 0)
{
PrintString("Sleeping for 2 seconds...\n");
native_sleep(2000);
PrintString("Awake!\n");
}
else if (my_strncmp(command, "DIR ", 4) == 0)
{
PrintString("Listing DIR: %s\n", command + 4);
list_dir(command + 4);
}
else if (my_strncmp(command, "LSDEV ", 6) == 0)
{
PrintString("Listing DEV: %s\n", command + 6);
list_dev(command + 6);
}
else if (my_strncmp(command, "RUN ", 4) == 0)
{
PrintString("Creating process: %s\n", command + 4);
create_proc(command + 4);
}
else if(my_strcmp(command, "EXIT") == 0)
{
PrintString("Exiting...\n");
RtlExitUserProcess(0);
}
else if(my_strcmp(command, "INT 3") == 0)
{
PrintString("Triggering breakpoint exception...\n");
NOP_Toy();
}
else
{
PrintString("Unknown command: %s\n", command);
}
}