This website works better with JavaScript.
Home
Explore
帮助
返回水杉在线
登录水杉在线
登录水杉码园
10195501438
/
Operating_System
Watch
3
Star
2
Fork
0
Code
Issues
0
Pull Requests
0
Releases
0
Wiki
Activity
Browse Source
-
master
陈越
3 years ago
parent
23fec04818
commit
ed7add6585
5 changed files
with
19 additions
and
9 deletions
Split View
Diff Options
Show Stats
Download Patch File
Download Diff File
+1
-2
fun_1.c
+2
-2
fun_2.c
BIN
main
+12
-3
main.c
+4
-2
mytop.c
+ 1
- 2
fun_1.c
View File
@ -7,13 +7,12 @@
#
include
"mytop.c"
/
/
#
include
"
fun.h
"
void
eval
(
char
*
cmdline
)
{
char
*
argv
[
MAXLINE
]
;
char
buf
[
MAXLINE
]
;
int
isBg
;
in
t
pid
;
pid_
t
pid
;
strcpy
(
buf
,
cmdline
)
;
isBg
=
parseline
(
cmdline
,
argv
)
;
if
(
argv
[
0
]
=
=
NULL
)
+ 2
- 2
fun_2.c
View File
@ -160,7 +160,7 @@ if(Isopen == '>')
int
Is_redirect
(
char
*
*
argv
)
{
int
i
=
0
;
char
Isopen
=
NULL
;
char
Isopen
=
'
0
'
;
char
*
cmd_0
[
MAXLINE
]
;
char
*
cmd_1
[
MAXLINE
]
;
while
(
argv
[
i
]
!
=
NULL
)
@ -175,7 +175,7 @@ int Is_redirect(char **argv)
}
i
+
+
;
}
if
(
Isopen
=
=
NULL
)
if
(
Isopen
=
=
'
0
'
)
{
return
0
;
}
BIN
main
View File
+ 12
- 3
main.c
View File
@ -1,19 +1,28 @@
#
include
<stdio.h>
#
include
<stdlib.h>
#
include
"fun.h"
pid_t
main_proc_pid
;
void
sigint_handler
(
)
{
/*
pid_t
pid
=
getpid
(
)
;
if
(
pid
!
=
main_proc_pid
)
{
exit
(
0
)
;
}
*/
}
int
main
(
)
{
char
cmdline
[
MAXLINE
]
;
main_proc_pid
=
getpid
(
)
;
signal
(
SIGINT
,
sigint_handler
)
;
while
(
1
)
{
int
bufsize
=
MAXLINE
;
printf
(
"
COMMAND->
"
)
;
fgets
(
cmdline
,
MAXLINE
,
stdin
)
;
eval
(
cmdline
)
;
history
(
cmdline
)
;
}
return
0
;
}
}
+ 4
- 2
mytop.c
View File
@ -1,4 +1,4 @@
/*
#
define mytop_h
#
include
<stdio.h>
#
include
<unistd.h>
@ -399,4 +399,6 @@ int mytop(){
/
/
fflush
(
NULL
)
;
return
0
;
}
}
*/
int
mytop
(
)
{
}
Write
Preview
Loading…
Cancel
Save