Changeset 2456fd0 in mainline for uspace/app/mkfat/mkfat.c
- Timestamp:
- 2017-07-03T18:14:01Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d858a660
- Parents:
- 58fa3e6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/mkfat/mkfat.c
r58fa3e6 r2456fd0 116 116 117 117 --argc; ++argv; 118 if (str_cmp(*argv, "--size") == 0) { 119 --argc; ++argv; 120 if (*argv == NULL) { 121 printf(NAME ": Error, argument missing.\n"); 122 syntax_print(); 123 return 1; 118 119 while (*argv[0] == '-') { 120 if (str_cmp(*argv, "--size") == 0) { 121 --argc; ++argv; 122 if (*argv == NULL) { 123 printf(NAME ": Error, argument missing.\n"); 124 syntax_print(); 125 return 1; 126 } 127 128 cfg.total_sectors = strtol(*argv, &endptr, 10); 129 if (*endptr != '\0') { 130 printf(NAME ": Error, invalid argument.\n"); 131 syntax_print(); 132 return 1; 133 } 134 135 --argc; ++argv; 124 136 } 125 137 126 cfg.total_sectors = strtol(*argv, &endptr, 10); 127 if (*endptr != '\0') { 128 printf(NAME ": Error, invalid argument.\n"); 129 syntax_print(); 130 return 1; 138 if (str_cmp(*argv, "--type") == 0) { 139 --argc; ++argv; 140 if (*argv == NULL) { 141 printf(NAME ": Error, argument missing.\n"); 142 syntax_print(); 143 return 1; 144 } 145 146 cfg.fat_type = strtol(*argv, &endptr, 10); 147 if (*endptr != '\0') { 148 printf(NAME ": Error, invalid argument.\n"); 149 syntax_print(); 150 return 1; 151 } 152 153 --argc; ++argv; 131 154 } 132 155 133 --argc; ++argv; 134 } 135 136 if (str_cmp(*argv, "--type") == 0) { 137 --argc; ++argv; 138 if (*argv == NULL) { 139 printf(NAME ": Error, argument missing.\n"); 140 syntax_print(); 141 return 1; 156 if (str_cmp(*argv, "--label") == 0) { 157 --argc; ++argv; 158 if (*argv == NULL) { 159 printf(NAME ": Error, argument missing.\n"); 160 syntax_print(); 161 return 1; 162 } 163 164 cfg.label = *argv; 165 166 --argc; ++argv; 142 167 } 143 168 144 cfg.fat_type = strtol(*argv, &endptr, 10); 145 if (*endptr != '\0') { 146 printf(NAME ": Error, invalid argument.\n"); 147 syntax_print(); 148 return 1; 169 if (str_cmp(*argv, "-") == 0) { 170 --argc; ++argv; 171 break; 149 172 } 150 151 --argc; ++argv;152 }153 154 if (str_cmp(*argv, "--label") == 0) {155 --argc; ++argv;156 if (*argv == NULL) {157 printf(NAME ": Error, argument missing.\n");158 syntax_print();159 return 1;160 }161 162 cfg.label = *argv;163 164 --argc; ++argv;165 173 } 166 174 … … 237 245 static void syntax_print(void) 238 246 { 239 printf("syntax: mkfat [--size <sectors>] [--type 12|16|32] " 240 "[--label <label>] <device_name>\n"); 247 printf("syntax: mkfat [<options>...] <device_name>\n"); 248 printf("options:\n" 249 "\t--size <sectors> Filesystem size, overrides device size\n" 250 "\t--type 12|16|32 FAT type (auto-detected by default)\n" 251 "\t--label <label> Volume label\n"); 241 252 } 242 253
Note:
See TracChangeset
for help on using the changeset viewer.