Lines Matching refs:path

87 static void create_abs_path(const char *name, char *path, size_t len)  in create_abs_path()  argument
90 strncpy(path, name, len); in create_abs_path()
91 path[len - 1] = '\0'; in create_abs_path()
95 *path++ = '/'; in create_abs_path()
98 strncpy(path, name, len); in create_abs_path()
99 path[len - 1] = '\0'; in create_abs_path()
101 strncpy(path, cwd, len); in create_abs_path()
102 path[len - 1] = '\0'; in create_abs_path()
104 size_t plen = strlen(path); in create_abs_path()
107 path += plen; in create_abs_path()
108 *path++ = '/'; in create_abs_path()
110 strncpy(path, name, len); in create_abs_path()
111 path[len - 1] = '\0'; in create_abs_path()
119 char path[MAX_PATH_LEN]; in cmd_cd() local
141 create_abs_path(argv[1], path, sizeof(path)); in cmd_cd()
143 err = fs_stat(path, &entry); in cmd_cd()
145 shell_error(sh, "%s doesn't exist", path); in cmd_cd()
150 shell_error(sh, "%s is not a directory", path); in cmd_cd()
154 strncpy(cwd, path, sizeof(cwd)); in cmd_cd()
162 char path[MAX_PATH_LEN]; in cmd_ls() local
167 strncpy(path, cwd, sizeof(path)); in cmd_ls()
168 path[sizeof(path) - 1] = '\0'; in cmd_ls()
170 create_abs_path(argv[1], path, sizeof(path)); in cmd_ls()
175 err = fs_opendir(&dir, path); in cmd_ls()
177 shell_error(sh, "Unable to open %s (err %d)", path, err); in cmd_ls()
213 char path[MAX_PATH_LEN]; in cmd_trunc() local
218 create_abs_path(argv[1], path, sizeof(path)); in cmd_trunc()
227 err = fs_open(&file, path, FS_O_WRITE); in cmd_trunc()
229 shell_error(sh, "Failed to open %s (%d)", path, err); in cmd_trunc()
235 shell_error(sh, "Failed to truncate %s (%d)", path, err); in cmd_trunc()
247 char path[MAX_PATH_LEN]; in cmd_mkdir() local
249 create_abs_path(argv[1], path, sizeof(path)); in cmd_mkdir()
251 err = fs_mkdir(path); in cmd_mkdir()
263 char path[MAX_PATH_LEN]; in cmd_rm() local
265 create_abs_path(argv[1], path, sizeof(path)); in cmd_rm()
267 err = fs_unlink(path); in cmd_rm()
269 shell_error(sh, "Failed to remove %s (%d)", path, err); in cmd_rm()
278 char path[MAX_PATH_LEN]; in cmd_read() local
285 create_abs_path(argv[1], path, sizeof(path)); in cmd_read()
302 err = fs_stat(path, &dirent); in cmd_read()
305 path, err); in cmd_read()
310 shell_error(sh, "Not a file %s", path); in cmd_read()
317 err = fs_open(&file, path, FS_O_READ); in cmd_read()
319 shell_error(sh, "Failed to open %s (%d)", path, err); in cmd_read()
327 path, err); in cmd_read()
372 char path[MAX_PATH_LEN]; in cmd_cat() local
382 create_abs_path(argv[i], path, sizeof(path)); in cmd_cat()
384 err = fs_stat(path, &dirent); in cmd_cat()
387 path, err); in cmd_cat()
392 shell_error(sh, "Not a file %s", path); in cmd_cat()
396 err = fs_open(&file, path, FS_O_READ); in cmd_cat()
398 shell_error(sh, "Failed to open %s (%d)", path, err); in cmd_cat()
415 path, read); in cmd_cat()
427 char path[MAX_PATH_LEN]; in cmd_statvfs() local
430 create_abs_path(argv[1], path, sizeof(path)); in cmd_statvfs()
432 err = fs_statvfs(path, &stat); in cmd_statvfs()
434 shell_error(sh, "Failed to statvfs %s (%d)", path, err); in cmd_statvfs()
447 char path[MAX_PATH_LEN]; in cmd_write() local
455 create_abs_path(argv[1], path, sizeof(path)); in cmd_write()
471 err = fs_open(&file, path, FS_O_CREATE | FS_O_WRITE); in cmd_write()
473 shell_error(sh, "Failed to open %s (%d)", path, err); in cmd_write()
483 shell_error(sh, "Failed to seek %s (%d)", path, err); in cmd_write()
496 path, err); in cmd_write()
548 char path[MAX_PATH_LEN]; in cmd_read_test() local
566 create_abs_path(argv[1], path, sizeof(path)); in cmd_read_test()
574 err = fs_stat(path, &dirent); in cmd_read_test()
594 err = fs_open(&file, path, FS_O_READ); in cmd_read_test()
596 shell_error(sh, "Failed to open %s (%d)", path, err); in cmd_read_test()
606 path, err); in cmd_read_test()
641 char path[MAX_PATH_LEN]; in cmd_erase_write_test() local
658 create_abs_path(argv[1], path, sizeof(path)); in cmd_erase_write_test()
683 err = fs_open(&file, path, FS_O_CREATE | FS_O_WRITE); in cmd_erase_write_test()
685 shell_error(sh, "Failed to open %s (%d)", path, err); in cmd_erase_write_test()
695 err = fs_unlink(path); in cmd_erase_write_test()
697 shell_error(sh, "Failed to delete %s (%d)", path, err); in cmd_erase_write_test()
701 err = fs_open(&file, path, FS_O_CREATE | FS_O_WRITE); in cmd_erase_write_test()
703 shell_error(sh, "Failed to open %s (%d)", path, err); in cmd_erase_write_test()
707 shell_error(sh, "Failed to truncate %s (%d)", path, err); in cmd_erase_write_test()
724 path, err); in cmd_erase_write_test()