Finish lab 5.
This commit is contained in:
11
user/sh.c
11
user/sh.c
@@ -53,9 +53,16 @@ again:
|
||||
// then check whether 'fd' is 0.
|
||||
// If not, dup 'fd' onto file descriptor 0,
|
||||
// then close the original 'fd'.
|
||||
|
||||
// LAB 5: Your code here.
|
||||
panic("< redirection not implemented");
|
||||
if ((fd = open(t, O_RDONLY)) < 0) {
|
||||
cprintf("open %s for read: %e", t, fd);
|
||||
}
|
||||
|
||||
if(fd != 0) {
|
||||
dup(fd, 0);
|
||||
close(fd);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case '>': // Output redirection
|
||||
|
||||
Reference in New Issue
Block a user