Changeset 4979403 in mainline for uspace/app/bdsh/cmds/modules/mount/mount.c
- Timestamp:
- 2011-09-23T15:39:07Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 286286c
- Parents:
- 8895d05
- git-author:
- Maurizio Lombardi <m.lombardi85@…> (2011-09-23 15:39:07)
- git-committer:
- Jakub Jermar <jakub@…> (2011-09-23 15:39:07)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/mount/mount.c
r8895d05 r4979403 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 }; … … 68 69 const char *dev = ""; 69 70 int rc, c, opt_ind; 71 unsigned int instance = 0; 72 bool instance_set = false; 73 char **t_argv; 70 74 71 75 argc = cli_count_args(argv); 72 76 73 77 for (c = 0, optind = 0, opt_ind = 0; c != -1;) { 74 c = getopt_long(argc, argv, " h", long_options, &opt_ind);78 c = getopt_long(argc, argv, "i:h", long_options, &opt_ind); 75 79 switch (c) { 76 80 case 'h': 77 81 help_cmd_mount(HELP_LONG); 78 82 return CMD_SUCCESS; 83 case 'i': 84 instance = (unsigned int) strtol(optarg, NULL, 10); 85 instance_set = true; 86 break; 79 87 } 80 88 } 89 90 if (instance_set) { 91 argc -= 2; 92 t_argv = &argv[2]; 93 } else 94 t_argv = &argv[0]; 81 95 82 96 if ((argc < 3) || (argc > 5)) { … … 86 100 } 87 101 if (argc > 3) 88 dev = argv[3];102 dev = t_argv[3]; 89 103 if (argc == 5) 90 mopts = argv[4];104 mopts = t_argv[4]; 91 105 92 rc = mount( argv[1], argv[2], dev, mopts, 0);106 rc = mount(t_argv[1], t_argv[2], dev, mopts, 0, instance); 93 107 if (rc != EOK) { 94 108 printf("Unable to mount %s filesystem to %s on %s (rc=%d)\n", 95 argv[1], argv[2],argv[3], rc);109 t_argv[1], t_argv[2], t_argv[3], rc); 96 110 return CMD_FAILURE; 97 111 }
Note:
See TracChangeset
for help on using the changeset viewer.