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