Changeset b19e892 in mainline for uspace/app/bdsh/cmds
- Timestamp:
- 2017-04-02T10:39:13Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9c4cf0d
- Parents:
- 80743a1
- Location:
- uspace/app/bdsh/cmds/modules
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/cat/cat.c
r80743a1 rb19e892 33 33 #include <getopt.h> 34 34 #include <str.h> 35 #include <fcntl.h>36 35 #include <io/console.h> 37 36 #include <io/color.h> … … 196 195 blen = STR_BOUNDS(1); 197 196 } else 198 fd = open(fname, O_RDONLY);197 fd = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ); 199 198 200 199 if (fd < 0) { -
uspace/app/bdsh/cmds/modules/cmp/cmp.c
r80743a1 rb19e892 28 28 29 29 #include <errno.h> 30 #include <fcntl.h>31 30 #include <getopt.h> 32 31 #include <mem.h> … … 82 81 83 82 for (int i = 0; i < 2; i++) { 84 fd[i] = open(fn[i], O_RDONLY);83 fd[i] = vfs_lookup_open(fn[i], WALK_REGULAR, MODE_READ); 85 84 if (fd[i] < 0) { 86 rc = errno;85 rc = fd[i]; 87 86 printf("Unable to open %s\n", fn[i]); 88 87 goto end; -
uspace/app/bdsh/cmds/modules/cp/cp.c
r80743a1 rb19e892 35 35 #include <getopt.h> 36 36 #include <str.h> 37 #include <fcntl.h>38 37 #include <vfs/vfs.h> 39 38 #include <dirent.h> … … 383 382 printf("Copying %s to %s\n", src, dest); 384 383 385 if (-1 == (fd1 = open(src, O_RDONLY))) { 384 fd1 = vfs_lookup_open(src, WALK_REGULAR, MODE_READ); 385 if (fd1 < 0) { 386 386 printf("Unable to open source file %s\n", src); 387 387 return -1; 388 388 } 389 389 390 if (-1 == (fd2 = open(dest, O_WRONLY | O_CREAT))) { 390 fd2 = vfs_lookup_open(dest, WALK_REGULAR | WALK_MAY_CREATE, MODE_WRITE); 391 if (fd2 < 0) { 391 392 printf("Unable to open destination file %s\n", dest); 392 393 close(fd1); -
uspace/app/bdsh/cmds/modules/ls/ls.c
r80743a1 rb19e892 36 36 #include <unistd.h> 37 37 #include <dirent.h> 38 #include <fcntl.h>39 38 #include <getopt.h> 40 39 #include <sys/types.h> -
uspace/app/bdsh/cmds/modules/mkdir/mkdir.c
r80743a1 rb19e892 30 30 #include <stdlib.h> 31 31 #include <dirent.h> 32 #include <fcntl.h>33 32 #include <sys/types.h> 34 33 #include <getopt.h> -
uspace/app/bdsh/cmds/modules/mkfile/mkfile.c
r80743a1 rb19e892 31 31 #include <stdlib.h> 32 32 #include <dirent.h> 33 #include <fcntl.h>34 33 #include <sys/types.h> 35 34 #include <macros.h> … … 38 37 #include <str.h> 39 38 #include <ctype.h> 39 #include <vfs/vfs.h> 40 40 41 41 #include "config.h" … … 156 156 file_name = argv[optind]; 157 157 158 fd = open(file_name, O_CREAT | O_EXCL | O_WRONLY, 0666);158 fd = vfs_lookup_open(file_name, WALK_REGULAR | WALK_MUST_CREATE, MODE_WRITE); 159 159 if (fd < 0) { 160 160 printf("%s: failed to create file %s.\n", cmdname, file_name); -
uspace/app/bdsh/cmds/modules/rm/rm.c
r80743a1 rb19e892 31 31 #include <stdlib.h> 32 32 #include <unistd.h> 33 #include <fcntl.h>34 33 #include <dirent.h> 35 34 #include <getopt.h> … … 151 150 } 152 151 153 fd = open(path, O_RDONLY);152 fd = vfs_lookup(path, WALK_REGULAR); 154 153 if (fd >= 0) { 155 154 close(fd); -
uspace/app/bdsh/cmds/modules/touch/touch.c
r80743a1 rb19e892 35 35 #include <stdlib.h> 36 36 #include <unistd.h> 37 #include <fcntl.h>38 37 #include <dirent.h> 39 38 #include <sys/types.h> … … 125 124 if ((!no_create) || 126 125 ((no_create) && (vfs_stat_path(buff, &file_stat) == EOK))) { 127 fd = open(buff, O_RDWR | O_CREAT);126 fd = vfs_lookup(buff, WALK_REGULAR | WALK_MAY_CREATE); 128 127 } 129 128
Note:
See TracChangeset
for help on using the changeset viewer.