traceroute: fix help text to not show -6 when traceroute6 is off
[oweals/busybox.git] / libbb / getopt32.c
index 1eb868c97333689cc83355e742476b975dddcd55..cab3eb745302868d1deb1888d2fb02cbbe1afe1e 100644 (file)
@@ -147,15 +147,15 @@ const char *opt_complementary
 
 Special characters:
 
- "-"    A dash as the first char in a opt_complementary group forces
-        all arguments to be treated as options, even if they have
-        no leading dashes. Next char in this case can't be a digit (0-9),
-        use ':' or end of line. For example:
+ "-"    A group consisting of just a dash forces all arguments
+        to be treated as options, even if they have no leading dashes.
+        Next char in this case can't be a digit (0-9), use ':' or end of line.
+        Example:
 
-        opt_complementary = "-:w-x:x-w";
-        getopt32(argv, "wx");
+        opt_complementary = "-:w-x:x-w"; // "-w-x:x-w" would also work,
+        getopt32(argv, "wx");            // but is less readable
 
-        Allows any arguments to be given without a dash (./program w x)
+        This makes it possible to use options without a dash (./program w x)
         as well as with a dash (./program -x).
 
         NB: getopt32() will leak a small amount of memory if you use
@@ -314,7 +314,7 @@ typedef struct {
 } t_complementary;
 
 /* You can set applet_long_options for parse called long options */
-#if ENABLE_GETOPT_LONG
+#if ENABLE_LONG_OPTS || ENABLE_FEATURE_GETOPT_LONG
 static const struct option bb_null_long_options[1] = {
        { 0, 0, 0, 0 }
 };
@@ -335,7 +335,7 @@ getopt32(char **argv, const char *applet_opts, ...)
        const unsigned char *s;
        t_complementary *on_off;
        va_list p;
-#if ENABLE_GETOPT_LONG
+#if ENABLE_LONG_OPTS || ENABLE_FEATURE_GETOPT_LONG
        const struct option *l_o;
        struct option *long_options = (struct option *) &bb_null_long_options;
 #endif
@@ -384,7 +384,7 @@ getopt32(char **argv, const char *applet_opts, ...)
                c++;
        }
 
-#if ENABLE_GETOPT_LONG
+#if ENABLE_LONG_OPTS || ENABLE_FEATURE_GETOPT_LONG
        if (applet_long_options) {
                const char *optstr;
                unsigned i, count;
@@ -424,7 +424,7 @@ getopt32(char **argv, const char *applet_opts, ...)
  next_long: ;
                }
        }
-#endif /* ENABLE_GETOPT_LONG */
+#endif /* ENABLE_LONG_OPTS || ENABLE_FEATURE_GETOPT_LONG */
        for (s = (const unsigned char *)opt_complementary; s && *s; s++) {
                t_complementary *pair;
                unsigned *pair_switch;
@@ -543,7 +543,7 @@ getopt32(char **argv, const char *applet_opts, ...)
         * "fake" short options, like this one:
         * wget $'-\203' "Test: test" http://kernel.org/
         * (supposed to act as --header, but doesn't) */
-#if ENABLE_GETOPT_LONG
+#if ENABLE_LONG_OPTS || ENABLE_FEATURE_GETOPT_LONG
        while ((c = getopt_long(argc, argv, applet_opts,
                        long_options, NULL)) != -1) {
 #else