Changes in uspace/app/bdsh/cmds/modules/mount/mount.c [e6cb880:286286c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/mount/mount.c
re6cb880 r286286c 43 43 static struct option const long_options[] = { 44 44 { "help", no_argument, 0, 'h' }, 45 { "instance", required_argument, 0, 'i' }, 45 46 { 0, 0, 0, 0 } 46 47 }; … … 51 52 { 52 53 static char helpfmt[] = 53 "Usage: %s <fstype> <mp> <dev>[<moptions>]\n";54 "Usage: %s <fstype> <mp> [dev] [<moptions>]\n"; 54 55 if (level == HELP_SHORT) { 55 56 printf("'%s' mounts a file system.\n", cmdname); … … 66 67 unsigned int argc; 67 68 const char *mopts = ""; 69 const char *dev = ""; 68 70 int rc, c, opt_ind; 71 unsigned int instance = 0; 72 bool instance_set = false; 73 char **t_argv; 69 74 70 75 argc = cli_count_args(argv); 71 76 72 77 for (c = 0, optind = 0, opt_ind = 0; c != -1;) { 73 c = getopt_long(argc, argv, " h", long_options, &opt_ind);78 c = getopt_long(argc, argv, "i:h", long_options, &opt_ind); 74 79 switch (c) { 75 80 case 'h': 76 81 help_cmd_mount(HELP_LONG); 77 82 return CMD_SUCCESS; 83 case 'i': 84 instance = (unsigned int) strtol(optarg, NULL, 10); 85 instance_set = true; 86 break; 78 87 } 79 88 } 80 89 81 if ((argc < 4) || (argc > 5)) { 90 if (instance_set) { 91 argc -= 2; 92 t_argv = &argv[2]; 93 } else 94 t_argv = &argv[0]; 95 96 if ((argc < 3) || (argc > 5)) { 82 97 printf("%s: invalid number of arguments. Try `mount --help'\n", 83 98 cmdname); 84 99 return CMD_FAILURE; 85 100 } 101 if (argc > 3) 102 dev = t_argv[3]; 86 103 if (argc == 5) 87 mopts = argv[4];104 mopts = t_argv[4]; 88 105 89 rc = mount( argv[1], argv[2], argv[3], mopts, 0);106 rc = mount(t_argv[1], t_argv[2], dev, mopts, 0, instance); 90 107 if (rc != EOK) { 91 108 printf("Unable to mount %s filesystem to %s on %s (rc=%d)\n", 92 argv[1], argv[2],argv[3], rc);109 t_argv[1], t_argv[2], t_argv[3], rc); 93 110 return CMD_FAILURE; 94 111 }
Note:
See TracChangeset
for help on using the changeset viewer.