diff options
author | Manuel Novoa III <mjn3@codepoet.org> | 2003-03-19 09:13:01 +0000 |
---|---|---|
committer | Manuel Novoa III <mjn3@codepoet.org> | 2003-03-19 09:13:01 +0000 |
commit | cad5364599eb5062d59e0c397ed638ddd61a8d5d (patch) | |
tree | a318d0f03aa076c74b576ea45dc543a5669e8e91 /util-linux/getopt.c | |
parent | e01f9662a5bd5d91be4f6b3941b57fff73cd5af1 (diff) | |
download | busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.gz busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.bz2 busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.zip |
Major coreutils update.
Diffstat (limited to 'util-linux/getopt.c')
-rw-r--r-- | util-linux/getopt.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/util-linux/getopt.c b/util-linux/getopt.c index e126d7b6e..25eeab69b 100644 --- a/util-linux/getopt.c +++ b/util-linux/getopt.c | |||
@@ -37,7 +37,7 @@ | |||
37 | * <misiek@misiek.eu.org>) | 37 | * <misiek@misiek.eu.org>) |
38 | * Ported to Busybox - Alfred M. Szmidt <ams@trillian.itslinux.org> | 38 | * Ported to Busybox - Alfred M. Szmidt <ams@trillian.itslinux.org> |
39 | * Removed --version/-V and --help/-h in | 39 | * Removed --version/-V and --help/-h in |
40 | * Removed prase_error(), using error_msg() from Busybox instead | 40 | * Removed prase_error(), using bb_error_msg() from Busybox instead |
41 | * Replaced our_malloc with xmalloc and our_realloc with xrealloc | 41 | * Replaced our_malloc with xmalloc and our_realloc with xrealloc |
42 | * | 42 | * |
43 | */ | 43 | */ |
@@ -95,7 +95,7 @@ const char *normalize(const char *arg) | |||
95 | free(BUFFER); | 95 | free(BUFFER); |
96 | 96 | ||
97 | if (!quote) { /* Just copy arg */ | 97 | if (!quote) { /* Just copy arg */ |
98 | BUFFER=xstrdup(arg); | 98 | BUFFER=bb_xstrdup(arg); |
99 | return BUFFER; | 99 | return BUFFER; |
100 | } | 100 | } |
101 | 101 | ||
@@ -224,7 +224,7 @@ void add_longopt(const char *name,int has_arg) | |||
224 | long_options[long_options_nr-1].has_arg=has_arg; | 224 | long_options[long_options_nr-1].has_arg=has_arg; |
225 | long_options[long_options_nr-1].flag=NULL; | 225 | long_options[long_options_nr-1].flag=NULL; |
226 | long_options[long_options_nr-1].val=LONG_OPT; | 226 | long_options[long_options_nr-1].val=LONG_OPT; |
227 | long_options[long_options_nr-1].name=xstrdup(name); | 227 | long_options[long_options_nr-1].name=bb_xstrdup(name); |
228 | } | 228 | } |
229 | long_options_nr++; | 229 | long_options_nr++; |
230 | } | 230 | } |
@@ -254,7 +254,7 @@ void add_long_options(char *options) | |||
254 | arg_opt=required_argument; | 254 | arg_opt=required_argument; |
255 | } | 255 | } |
256 | if (tlen == 0) | 256 | if (tlen == 0) |
257 | error_msg("empty long option after -l or --long argument"); | 257 | bb_error_msg("empty long option after -l or --long argument"); |
258 | } | 258 | } |
259 | add_longopt(tokptr,arg_opt); | 259 | add_longopt(tokptr,arg_opt); |
260 | } | 260 | } |
@@ -273,7 +273,7 @@ void set_shell(const char *new_shell) | |||
273 | else if (!strcmp(new_shell,"csh")) | 273 | else if (!strcmp(new_shell,"csh")) |
274 | shell=TCSH; | 274 | shell=TCSH; |
275 | else | 275 | else |
276 | error_msg("unknown shell after -s or --shell argument"); | 276 | bb_error_msg("unknown shell after -s or --shell argument"); |
277 | } | 277 | } |
278 | 278 | ||
279 | 279 | ||
@@ -322,7 +322,7 @@ int getopt_main(int argc, char *argv[]) | |||
322 | printf(" --\n"); | 322 | printf(" --\n"); |
323 | return 0; | 323 | return 0; |
324 | } else | 324 | } else |
325 | error_msg_and_die("missing optstring argument"); | 325 | bb_error_msg_and_die("missing optstring argument"); |
326 | } | 326 | } |
327 | 327 | ||
328 | if (argv[1][0] != '-' || compatible) { | 328 | if (argv[1][0] != '-' || compatible) { |
@@ -340,14 +340,14 @@ int getopt_main(int argc, char *argv[]) | |||
340 | break; | 340 | break; |
341 | case 'o': | 341 | case 'o': |
342 | free(optstr); | 342 | free(optstr); |
343 | optstr=xstrdup(optarg); | 343 | optstr=bb_xstrdup(optarg); |
344 | break; | 344 | break; |
345 | case 'l': | 345 | case 'l': |
346 | add_long_options(optarg); | 346 | add_long_options(optarg); |
347 | break; | 347 | break; |
348 | case 'n': | 348 | case 'n': |
349 | free(name); | 349 | free(name); |
350 | name=xstrdup(optarg); | 350 | name=bb_xstrdup(optarg); |
351 | break; | 351 | break; |
352 | case 'q': | 352 | case 'q': |
353 | quiet_errors=1; | 353 | quiet_errors=1; |
@@ -364,14 +364,14 @@ int getopt_main(int argc, char *argv[]) | |||
364 | quote=0; | 364 | quote=0; |
365 | break; | 365 | break; |
366 | default: | 366 | default: |
367 | show_usage(); | 367 | bb_show_usage(); |
368 | } | 368 | } |
369 | 369 | ||
370 | if (!optstr) { | 370 | if (!optstr) { |
371 | if (optind >= argc) | 371 | if (optind >= argc) |
372 | error_msg_and_die("missing optstring argument"); | 372 | bb_error_msg_and_die("missing optstring argument"); |
373 | else { | 373 | else { |
374 | optstr=xstrdup(argv[optind]); | 374 | optstr=bb_xstrdup(argv[optind]); |
375 | optind++; | 375 | optind++; |
376 | } | 376 | } |
377 | } | 377 | } |