aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-05-31 14:12:51 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-05-31 14:12:51 +0000
commitf9437aaf5b92766260988e508607e193b0cfa29d (patch)
tree45b520d6c2c950adc8c1d8812955ccc631765e87
parent8d3a6f7aaf04b09d185652f87cb924702e700c51 (diff)
downloadbusybox-w32-f9437aaf5b92766260988e508607e193b0cfa29d.tar.gz
busybox-w32-f9437aaf5b92766260988e508607e193b0cfa29d.tar.bz2
busybox-w32-f9437aaf5b92766260988e508607e193b0cfa29d.zip
- make getopt_ulflags aware of CONFIG_GETOPT_LONG
-rw-r--r--libbb/getopt_ulflags.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libbb/getopt_ulflags.c b/libbb/getopt_ulflags.c
index dc40095ee..d569d7079 100644
--- a/libbb/getopt_ulflags.c
+++ b/libbb/getopt_ulflags.c
@@ -298,13 +298,14 @@ typedef struct {
298} t_complementally; 298} t_complementally;
299 299
300/* You can set bb_applet_long_options for parse called long options */ 300/* You can set bb_applet_long_options for parse called long options */
301 301#if ENABLE_GETOPT_LONG
302static const struct option bb_default_long_options[] = { 302static const struct option bb_default_long_options[] = {
303/* { "help", 0, NULL, '?' }, */ 303/* { "help", 0, NULL, '?' }, */
304 { 0, 0, 0, 0 } 304 { 0, 0, 0, 0 }
305}; 305};
306 306
307const struct option *bb_applet_long_options = bb_default_long_options; 307const struct option *bb_applet_long_options = bb_default_long_options;
308#endif
308 309
309unsigned long 310unsigned long
310bb_getopt_ulflags (int argc, char **argv, const char *applet_opts, ...) 311bb_getopt_ulflags (int argc, char **argv, const char *applet_opts, ...)
@@ -316,7 +317,9 @@ bb_getopt_ulflags (int argc, char **argv, const char *applet_opts, ...)
316 const unsigned char *s; 317 const unsigned char *s;
317 t_complementally *on_off; 318 t_complementally *on_off;
318 va_list p; 319 va_list p;
320#if ENABLE_GETOPT_LONG
319 const struct option *l_o; 321 const struct option *l_o;
322#endif
320 unsigned long trigger; 323 unsigned long trigger;
321#ifdef CONFIG_PS 324#ifdef CONFIG_PS
322 char **pargv = NULL; 325 char **pargv = NULL;
@@ -355,6 +358,7 @@ bb_getopt_ulflags (int argc, char **argv, const char *applet_opts, ...)
355 c++; 358 c++;
356 } 359 }
357 360
361#if ENABLE_GETOPT_LONG
358 for(l_o = bb_applet_long_options; l_o->name; l_o++) { 362 for(l_o = bb_applet_long_options; l_o->name; l_o++) {
359 if(l_o->flag) 363 if(l_o->flag)
360 continue; 364 continue;
@@ -371,6 +375,7 @@ bb_getopt_ulflags (int argc, char **argv, const char *applet_opts, ...)
371 c++; 375 c++;
372 } 376 }
373 } 377 }
378#endif /* ENABLE_GETOPT_LONG */
374 for (s = (const unsigned char *)bb_opt_complementally; s && *s; s++) { 379 for (s = (const unsigned char *)bb_opt_complementally; s && *s; s++) {
375 t_complementally *pair; 380 t_complementally *pair;
376 unsigned long *pair_switch; 381 unsigned long *pair_switch;
@@ -452,8 +457,12 @@ bb_getopt_ulflags (int argc, char **argv, const char *applet_opts, ...)
452 } 457 }
453 } 458 }
454#endif 459#endif
460#if ENABLE_GETOPT_LONG
455 while ((c = getopt_long (argc, argv, applet_opts, 461 while ((c = getopt_long (argc, argv, applet_opts,
456 bb_applet_long_options, NULL)) >= 0) { 462 bb_applet_long_options, NULL)) >= 0) {
463#else
464 while ((c = getopt (argc, argv, applet_opts)) >= 0) {
465#endif /* ENABLE_GETOPT_LONG */
457#ifdef CONFIG_PS 466#ifdef CONFIG_PS
458loop_arg_is_opt: 467loop_arg_is_opt:
459#endif 468#endif