-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell.c
More file actions
44 lines (36 loc) · 872 Bytes
/
shell.c
File metadata and controls
44 lines (36 loc) · 872 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
35
36
37
38
39
40
41
42
43
44
# include "headers.h"
int main(int argc, char * argv[])
{
long long int i,j,k,pid;
int status;
char add_curd[10000],add_root[10000],cmd[100];
// pid_data[2].id = 21;
getcwd(add_curd,10000);
// printf("%s\n",add_curd);
// printf("%ld",strlen(add_curd));
for(i=strlen(argv[0])-1;i>=0;i--)
{
if(argv[0][i] == '/')
{
break;
}
}
argv[0][i]='\0';
// printf("%s\n",argv[0]);
chdir(argv[0]);
getcwd(add_root,10000);
// printf("%s",add_root);
fetch_history();
chdir(add_curd);
strcpy(lwd,add_root);
for(;;)
{
signal(SIGCHLD, child_killed);
// printf("WORKING SHELL");
display(add_root);
signal(SIGINT, signal_control);
signal(SIGTSTP, signal_control);
input(add_root);
// check_job_stat();
}
}