Lines Matching full:path
89 static void create_abs_path(const char *name, char *path, size_t len) in create_abs_path() argument
92 strncpy(path, name, len); in create_abs_path()
93 path[len - 1] = '\0'; in create_abs_path()
97 *path++ = '/'; in create_abs_path()
100 strncpy(path, name, len); in create_abs_path()
101 path[len - 1] = '\0'; in create_abs_path()
103 strncpy(path, cwd, len); in create_abs_path()
104 path[len - 1] = '\0'; in create_abs_path()
106 size_t plen = strlen(path); in create_abs_path()
109 path += plen; in create_abs_path()
110 *path++ = '/'; in create_abs_path()
112 strncpy(path, name, len); in create_abs_path()
113 path[len - 1] = '\0'; in create_abs_path()
121 char path[MAX_PATH_LEN]; in cmd_cd() local
143 create_abs_path(argv[1], path, sizeof(path)); in cmd_cd()
145 err = fs_stat(path, &entry); in cmd_cd()
147 shell_error(sh, "%s doesn't exist", path); in cmd_cd()
152 shell_error(sh, "%s is not a directory", path); in cmd_cd()
156 strncpy(cwd, path, sizeof(cwd)); in cmd_cd()
164 char path[MAX_PATH_LEN]; in cmd_ls() local
169 strncpy(path, cwd, sizeof(path)); in cmd_ls()
170 path[sizeof(path) - 1] = '\0'; in cmd_ls()
172 create_abs_path(argv[1], path, sizeof(path)); in cmd_ls()
177 err = fs_opendir(&dir, path); in cmd_ls()
179 shell_error(sh, "Unable to open %s (err %d)", path, err); in cmd_ls()
215 char path[MAX_PATH_LEN]; in cmd_trunc() local
220 create_abs_path(argv[1], path, sizeof(path)); in cmd_trunc()
229 err = fs_open(&file, path, FS_O_WRITE); in cmd_trunc()
231 shell_error(sh, "Failed to open %s (%d)", path, err); in cmd_trunc()
237 shell_error(sh, "Failed to truncate %s (%d)", path, err); in cmd_trunc()
249 char path[MAX_PATH_LEN]; in cmd_mkdir() local
251 create_abs_path(argv[1], path, sizeof(path)); in cmd_mkdir()
253 err = fs_mkdir(path); in cmd_mkdir()
265 char path[MAX_PATH_LEN]; in cmd_rm() local
267 create_abs_path(argv[1], path, sizeof(path)); in cmd_rm()
269 err = fs_unlink(path); in cmd_rm()
271 shell_error(sh, "Failed to remove %s (%d)", path, err); in cmd_rm()
280 char path[MAX_PATH_LEN]; in cmd_read() local
287 create_abs_path(argv[1], path, sizeof(path)); in cmd_read()
304 err = fs_stat(path, &dirent); in cmd_read()
307 path, err); in cmd_read()
312 shell_error(sh, "Not a file %s", path); in cmd_read()
319 err = fs_open(&file, path, FS_O_READ); in cmd_read()
321 shell_error(sh, "Failed to open %s (%d)", path, err); in cmd_read()
329 path, err); in cmd_read()
374 char path[MAX_PATH_LEN]; in cmd_cat() local
384 create_abs_path(argv[i], path, sizeof(path)); in cmd_cat()
386 err = fs_stat(path, &dirent); in cmd_cat()
389 path, err); in cmd_cat()
394 shell_error(sh, "Not a file %s", path); in cmd_cat()
398 err = fs_open(&file, path, FS_O_READ); in cmd_cat()
400 shell_error(sh, "Failed to open %s (%d)", path, err); in cmd_cat()
417 path, read); in cmd_cat()
429 char path[MAX_PATH_LEN]; in cmd_statvfs() local
432 create_abs_path(argv[1], path, sizeof(path)); in cmd_statvfs()
434 err = fs_statvfs(path, &stat); in cmd_statvfs()
436 shell_error(sh, "Failed to statvfs %s (%d)", path, err); in cmd_statvfs()
449 char path[MAX_PATH_LEN]; in cmd_write() local
457 create_abs_path(argv[1], path, sizeof(path)); in cmd_write()
473 err = fs_open(&file, path, FS_O_CREATE | FS_O_WRITE); in cmd_write()
475 shell_error(sh, "Failed to open %s (%d)", path, err); in cmd_write()
485 shell_error(sh, "Failed to seek %s (%d)", path, err); in cmd_write()
498 path, err); in cmd_write()
550 char path[MAX_PATH_LEN]; in cmd_read_test() local
564 shell_error(sh, "Missing parameters: read_test <path> <repeat>"); in cmd_read_test()
568 create_abs_path(argv[1], path, sizeof(path)); in cmd_read_test()
576 err = fs_stat(path, &dirent); in cmd_read_test()
584 shell_error(sh, "Provided path is not a file"); in cmd_read_test()
596 err = fs_open(&file, path, FS_O_READ); in cmd_read_test()
598 shell_error(sh, "Failed to open %s (%d)", path, err); in cmd_read_test()
608 path, err); in cmd_read_test()
643 char path[MAX_PATH_LEN]; in cmd_erase_write_test() local
656 shell_error(sh, "Missing parameters: erase_write_test <path> <size> <repeat>"); in cmd_erase_write_test()
660 create_abs_path(argv[1], path, sizeof(path)); in cmd_erase_write_test()
685 err = fs_open(&file, path, FS_O_CREATE | FS_O_WRITE); in cmd_erase_write_test()
687 shell_error(sh, "Failed to open %s (%d)", path, err); in cmd_erase_write_test()
697 err = fs_unlink(path); in cmd_erase_write_test()
699 shell_error(sh, "Failed to delete %s (%d)", path, err); in cmd_erase_write_test()
703 err = fs_open(&file, path, FS_O_CREATE | FS_O_WRITE); in cmd_erase_write_test()
705 shell_error(sh, "Failed to open %s (%d)", path, err); in cmd_erase_write_test()
709 shell_error(sh, "Failed to truncate %s (%d)", path, err); in cmd_erase_write_test()
726 path, err); in cmd_erase_write_test()