-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
34 lines (27 loc) · 801 Bytes
/
main.c
File metadata and controls
34 lines (27 loc) · 801 Bytes
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
#include "headers.h"
int main()
{
// Keep accepting commands
char home_dir[1024];
if (getcwd(home_dir, sizeof(home_dir)) == NULL) {
perror("Error getting current working directory");
return 1;
}
char prev_dir[1024];
snprintf(prev_dir, sizeof(prev_dir), "%s", home_dir);
pidlist head =(pidlist)malloc(sizeof(struct node));
head->next=NULL;
while (1)
{
get_username_systemname_and_directory(home_dir);
// Accept input
char input[MAX_COMMAND_LENGTH];
fgets(input, MAX_COMMAND_LENGTH, stdin);
checkbg(head);
// printf("%s\n",input);
// Process and execute command
// add_to_pastevents(input);
process_commands(input,home_dir,prev_dir,head);
}
return 0;
}