diff options
Diffstat (limited to 'user')
-rw-r--r-- | user/cat.c | 3 | ||||
-rw-r--r-- | user/grep.c | 3 | ||||
-rw-r--r-- | user/ls.c | 3 | ||||
-rw-r--r-- | user/wc.c | 3 |
4 files changed, 8 insertions, 4 deletions
@@ -1,5 +1,6 @@ #include "kernel/types.h" #include "kernel/stat.h" +#include "kernel/fcntl.h" #include "user/user.h" char buf[512]; @@ -32,7 +33,7 @@ main(int argc, char *argv[]) } for(i = 1; i < argc; i++){ - if((fd = open(argv[i], 0)) < 0){ + if((fd = open(argv[i], O_RDONLY)) < 0){ fprintf(2, "cat: cannot open %s\n", argv[i]); exit(1); } diff --git a/user/grep.c b/user/grep.c index 2315a0c..6c33766 100644 --- a/user/grep.c +++ b/user/grep.c @@ -2,6 +2,7 @@ #include "kernel/types.h" #include "kernel/stat.h" +#include "kernel/fcntl.h" #include "user/user.h" char buf[1024]; @@ -51,7 +52,7 @@ main(int argc, char *argv[]) } for(i = 2; i < argc; i++){ - if((fd = open(argv[i], 0)) < 0){ + if((fd = open(argv[i], O_RDONLY)) < 0){ printf("grep: cannot open %s\n", argv[i]); exit(1); } @@ -2,6 +2,7 @@ #include "kernel/stat.h" #include "user/user.h" #include "kernel/fs.h" +#include "kernel/fcntl.h" char* fmtname(char *path) @@ -30,7 +31,7 @@ ls(char *path) struct dirent de; struct stat st; - if((fd = open(path, 0)) < 0){ + if((fd = open(path, O_RDONLY)) < 0){ fprintf(2, "ls: cannot open %s\n", path); return; } @@ -1,5 +1,6 @@ #include "kernel/types.h" #include "kernel/stat.h" +#include "kernel/fcntl.h" #include "user/user.h" char buf[512]; @@ -43,7 +44,7 @@ main(int argc, char *argv[]) } for(i = 1; i < argc; i++){ - if((fd = open(argv[i], 0)) < 0){ + if((fd = open(argv[i], O_RDONLY)) < 0){ printf("wc: cannot open %s\n", argv[i]); exit(1); } |