[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] sorting optab by long option name
From: |
Andrew J. Schorr |
Subject: |
Re: [bug-gawk] sorting optab by long option name |
Date: |
Sat, 30 Nov 2013 15:51:07 -0500 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Hi Arnold,
On Thu, Nov 28, 2013 at 03:05:17AM -0700, address@hidden wrote:
> > I have two follow-up questions:
> >
> > 1. Shouldn't the --nostalgia option be disabled by default?
>
> No, it should be enabled by default. It's an Easter Egg. By definition
> Easter Eggs aren't any good if they are disabled.
I must be humorless, because I fail to see the entertainment value of a
command-line switch that simply causes the program to call abort. Isn't
an Easter Egg supposed to do something mysterious and fun?
> > 2. If we sort optab, should it be based on the short option character
> > or based on the long option name? I lean towards sorting by the short
> > option character, but I defer to you.
>
> I think it should be sorted by long option name, which will make it
> easier to search for missing options. The "parsedebug" option can remain
> last, since it's disabled by default, or you can include it in order;
> whatever you think will look best.
I think that if we sort it, parsedebug should be in proper sort order. Here's
a sorted version of the table (with a not-terribly-readable patch attached):
/* Sorted by long option name! */
static const struct option optab[] = {
{ "assign", required_argument, NULL, 'v' },
{ "bignum", no_argument, NULL, 'M' },
{ "characters-as-bytes", no_argument, & do_binary, 'b' },
{ "copyright", no_argument, NULL, 'C' },
{ "debug", optional_argument, NULL, 'D' },
{ "dump-variables", optional_argument, NULL, 'd' },
{ "exec", required_argument, NULL, 'E' },
{ "field-separator", required_argument, NULL, 'F' },
{ "file", required_argument, NULL, 'f' },
{ "gen-pot", no_argument, NULL, 'g' },
{ "help", no_argument, NULL, 'h' },
{ "include", required_argument, NULL, 'i' },
{ "lint", optional_argument, NULL, 'L' },
{ "lint-old", no_argument, NULL, 't' },
{ "load", required_argument, NULL, 'l' },
{ "non-decimal-data", no_argument, NULL, 'n' },
{ "nostalgia", no_argument, & do_nostalgia, 1 },
{ "optimize", no_argument, NULL, 'O' },
#if defined(YYDEBUG) || defined(GAWKDEBUG)
{ "parsedebug", no_argument, NULL, 'Y' },
#endif
{ "posix", no_argument, NULL, 'P' },
{ "pretty-print", optional_argument, NULL, 'o' },
{ "profile", optional_argument, NULL, 'p' },
{ "re-interval", no_argument, NULL, 'r' },
{ "sandbox", no_argument, NULL, 'S' },
{ "source", required_argument, NULL, 'e' },
{ "traditional", no_argument, NULL, 'c' },
{ "use-lc-numeric", no_argument, & use_lc_numeric, 1 },
{ "version", no_argument, & do_version, 'V' },
{ NULL, 0, NULL, '\0' }
};
Should I commit that to master? I can't see any reason to push it
to the stable branch, but please let me know if you disagree.
Regards,
Andy
optab.patch
Description: Text document