Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/modules/mount/mount.c

    r286286c re6cb880  
    4343static struct option const long_options[] = {
    4444        { "help", no_argument, 0, 'h' },
    45         { "instance", required_argument, 0, 'i' },
    4645        { 0, 0, 0, 0 }
    4746};
     
    5251{
    5352        static char helpfmt[] =
    54             "Usage:  %s <fstype> <mp> [dev] [<moptions>]\n";
     53            "Usage:  %s <fstype> <mp> <dev> [<moptions>]\n";
    5554        if (level == HELP_SHORT) {
    5655                printf("'%s' mounts a file system.\n", cmdname);
     
    6766        unsigned int argc;
    6867        const char *mopts = "";
    69         const char *dev = "";
    7068        int rc, c, opt_ind;
    71         unsigned int instance = 0;
    72         bool instance_set = false;
    73         char **t_argv;
    7469
    7570        argc = cli_count_args(argv);
    7671
    7772        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);
    7974                switch (c) {
    8075                case 'h':
    8176                        help_cmd_mount(HELP_LONG);
    8277                        return CMD_SUCCESS;
    83                 case 'i':
    84                         instance = (unsigned int) strtol(optarg, NULL, 10);
    85                         instance_set = true;
    86                         break;
    8778                }
    8879        }
    8980
    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)) {
    9782                printf("%s: invalid number of arguments. Try `mount --help'\n",
    9883                    cmdname);
    9984                return CMD_FAILURE;
    10085        }
    101         if (argc > 3)
    102                 dev = t_argv[3];
    10386        if (argc == 5)
    104                 mopts = t_argv[4];
     87                mopts = argv[4];
    10588
    106         rc = mount(t_argv[1], t_argv[2], dev, mopts, 0, instance);
     89        rc = mount(argv[1], argv[2], argv[3], mopts, 0);
    10790        if (rc != EOK) {
    10891                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);
    11093                return CMD_FAILURE;
    11194        }
Note: See TracChangeset for help on using the changeset viewer.