Mercurial > ecos-v3_0-branch
comparison packages/redboot/current/src/main.c @ 117:bd1a71e3e476 ecos-sw-2000-08-25
Merge from eCos master repository on 2000-08-25-19:22:58-BST
| author | jlarmour |
|---|---|
| date | Fri, 25 Aug 2000 19:17:22 +0000 |
| parents | 6ed91473a1cd |
| children | 518f42066aba |
comparison
equal
deleted
inserted
replaced
| 116:a0f9581a3a09 | 117:bd1a71e3e476 |
|---|---|
| 301 if (def_arg && (def_arg_type == OPTION_ARG_TYPE_STR)) { | 301 if (def_arg && (def_arg_type == OPTION_ARG_TYPE_STR)) { |
| 302 *def_arg = (char *)0; | 302 *def_arg = (char *)0; |
| 303 } | 303 } |
| 304 opt = opts; | 304 opt = opts; |
| 305 for (j = 0; j < num_opts; j++, opt++) { | 305 for (j = 0; j < num_opts; j++, opt++) { |
| 306 *opt->arg_set = false; | 306 if (opt->arg_set) { |
| 307 *opt->arg_set = false; | |
| 308 } | |
| 307 if (!opt->takes_arg) { | 309 if (!opt->takes_arg) { |
| 308 *(int *)opt->arg = 0; | 310 switch (opt->arg_type) { |
| 311 case OPTION_ARG_TYPE_NUM: | |
| 312 *(int *)opt->arg = 0; | |
| 313 break; | |
| 314 case OPTION_ARG_TYPE_FLG: | |
| 315 *(bool *)opt->arg = false; | |
| 316 break; | |
| 317 } | |
| 309 } | 318 } |
| 310 } | 319 } |
| 311 for (i = first; i < argc; i++) { | 320 for (i = first; i < argc; i++) { |
| 312 if (argv[i][0] == '-') { | 321 if (argv[i][0] == '-') { |
| 313 c = argv[i][1]; | 322 c = argv[i][1]; |
| 314 flag_ok = false; | 323 flag_ok = false; |
| 315 opt = opts; | 324 opt = opts; |
| 316 for (j = 0; j < num_opts; j++, opt++) { | 325 for (j = 0; j < num_opts; j++, opt++) { |
| 317 if (c == opt->flag) { | 326 if (c == opt->flag) { |
| 318 if (*opt->arg_set) { | 327 if (opt->arg_set && *opt->arg_set) { |
| 319 printf("%s alread set\n", opt->name); | 328 printf("%s alread set\n", opt->name); |
| 320 ret = false; | 329 ret = false; |
| 321 } | 330 } |
| 322 if (opt->takes_arg) { | 331 if (opt->takes_arg) { |
| 323 if (argv[i][2] == '=') { | 332 if (argv[i][2] == '=') { |
| 337 *opt->arg = s; | 346 *opt->arg = s; |
| 338 break; | 347 break; |
| 339 } | 348 } |
| 340 *opt->arg_set = true; | 349 *opt->arg_set = true; |
| 341 } else { | 350 } else { |
| 342 *(int *)opt->arg = *(int *)opt->arg + 1; | 351 switch (opt->arg_type) { |
| 352 case OPTION_ARG_TYPE_NUM: | |
| 353 *(int *)opt->arg = *(int *)opt->arg + 1; | |
| 354 break; | |
| 355 case OPTION_ARG_TYPE_FLG: | |
| 356 *(bool *)opt->arg = true; | |
| 357 break; | |
| 358 } | |
| 343 } | 359 } |
| 344 flag_ok = true; | 360 flag_ok = true; |
| 345 break; | 361 break; |
| 346 } | 362 } |
| 347 } | 363 } |
