OSDN Git Service

There are cases when the long options are of the format abc-def. In current implement...
authorAshwini Sharma <ak.ashwini1981@gmail.com>
Wed, 19 Mar 2014 18:57:06 +0000 (13:57 -0500)
committerAshwini Sharma <ak.ashwini1981@gmail.com>
Wed, 19 Mar 2014 18:57:06 +0000 (13:57 -0500)
I am of the opinion that __-__ be converted to '_' for generating the FLAG_xxx macros and be used in the command.

This will enable the user to 'abc-def', but be handled like 'abc_def' in code.

scripts/mkflags.c

index 1cad5bf..748e93d 100644 (file)
@@ -44,7 +44,7 @@ struct flag *digest(char *string)
         blank->lopt = new;
         list = blank;
       }
-      while (*++string != ')');  // An empty longopt () would break this.
+      while (*++string != ')') if (*string == '-') *string = '_';  // An empty longopt () would break this.
       *(string++) = 0;
       continue;
     }