Lines Matching refs:argv

104 void shell_run_built_in_command(int index, int argc, char **argv)  in shell_run_built_in_command()  argument
110 shell_cmds[index].func(argc, argv); in shell_run_built_in_command()
121 int shell_cmd_cd(int argc, char **argv) in shell_cmd_cd() argument
131 if (!strcmp(".", argv[1])) in shell_cmd_cd()
135 if (!strcmp("..", argv[1])) in shell_cmd_cd()
155 int dest_len = strlen(argv[1]); in shell_cmd_cd()
163 if (argv[1][0] == '/') in shell_cmd_cd()
166 int ec = chdir(argv[1]); in shell_cmd_cd()
174 strncpy(new_path, argv[1], dest_len); in shell_cmd_cd()
193 if (argv[1][0] == '.' && argv[1][1] == '/') // 相对路径 in shell_cmd_cd()
212 strcat(new_path, argv[1] + dest_offset); in shell_cmd_cd()
233 free(argv); in shell_cmd_cd()
244 int shell_cmd_ls(int argc, char **argv) in shell_cmd_ls() argument
276 if (argv != NULL) in shell_cmd_ls()
277 free(argv); in shell_cmd_ls()
289 int shell_cmd_pwd(int argc, char **argv) in shell_cmd_pwd() argument
293 if (argv != NULL) in shell_cmd_pwd()
294 free(argv); in shell_cmd_pwd()
305 int shell_cmd_cat(int argc, char **argv) in shell_cmd_cat() argument
308 char *file_path = get_target_filepath(argv[1], &path_len); in shell_cmd_cat()
330 if (argv != NULL) in shell_cmd_cat()
331 free(argv); in shell_cmd_cat()
342 int shell_cmd_touch(int argc, char **argv) in shell_cmd_touch() argument
347 if (argv[1][0] == '/') in shell_cmd_touch()
348 file_path = argv[1]; in shell_cmd_touch()
351 file_path = get_target_filepath(argv[1], &path_len); in shell_cmd_touch()
367 if (argv != NULL) in shell_cmd_touch()
368 free(argv); in shell_cmd_touch()
381 int shell_cmd_mkdir(int argc, char **argv) in shell_cmd_mkdir() argument
386 if (argv[1][0] == '/') in shell_cmd_mkdir()
387 full_path = argv[1]; in shell_cmd_mkdir()
390 full_path = get_target_filepath(argv[1], &result_path_len); in shell_cmd_mkdir()
396 if (argv != NULL) in shell_cmd_mkdir()
397 free(argv); in shell_cmd_mkdir()
410 int shell_cmd_rmdir(int argc, char **argv) in shell_cmd_rmdir() argument
416 if (argv[1][0] == '/') in shell_cmd_rmdir()
417 full_path = argv[1]; in shell_cmd_rmdir()
420 full_path = get_target_filepath(argv[1], &result_path_len); in shell_cmd_rmdir()
427 if (argv != NULL) in shell_cmd_rmdir()
428 free(argv); in shell_cmd_rmdir()
441 int shell_cmd_rm(int argc, char **argv) in shell_cmd_rm() argument
448 if (argv[1][0] == '/') in shell_cmd_rm()
449 full_path = argv[1]; in shell_cmd_rm()
452 full_path = get_target_filepath(argv[1], &result_path_len); in shell_cmd_rm()
462 if (argv != NULL) in shell_cmd_rm()
463 free(argv); in shell_cmd_rm()
474 int shell_cmd_exec(int argc, char **argv) in shell_cmd_exec() argument
485 char *file_path = get_target_filepath(argv[1], &path_len); in shell_cmd_exec()
487 execv(file_path, argv); in shell_cmd_exec()
488 free(argv); in shell_cmd_exec()
496 if (strcmp(argv[argc - 1], "&") != 0) in shell_cmd_exec()
503 free(argv); in shell_cmd_exec()
507 int shell_cmd_about(int argc, char **argv) in shell_cmd_about() argument
509 if (argv != NULL) in shell_cmd_about()
510 free(argv); in shell_cmd_about()
523 int shell_cmd_kill(int argc, char **argv) in shell_cmd_kill() argument
532 retval = syscall_invoke(SYS_KILL, atoi(argv[1]), SIGKILL, 0, 0, 0, 0, 0, 0); in shell_cmd_kill()
534 free(argv); in shell_cmd_kill()
545 int shell_cmd_reboot(int argc, char **argv) in shell_cmd_reboot() argument
550 int shell_cmd_free(int argc, char **argv) in shell_cmd_free() argument
553 if (argc == 2 && strcmp("-m", argv[1]) != 0) in shell_cmd_free()
556 printf("Invalid argument: %s\n", argv[1]); in shell_cmd_free()
582 if (argv != NULL) in shell_cmd_free()
583 free(argv); in shell_cmd_free()
595 int parse_command(char *buf, int *argc, char ***argv) in parse_command() argument
616 *argv = (char **)malloc(sizeof(char **) * (*argc)); in parse_command()
617 memset(*argv, 0, sizeof(char **) * (*argc)); in parse_command()
622 *((*argv) + i) = &buf[index]; in parse_command()
634 return shell_find_cmd(**argv); in parse_command()