[MINC-development] "Amusing" mincblur issue...
Andrew Janke
a.janke at gmail.com
Mon Nov 24 17:24:05 EST 2008
>> Switch to getopt_long ?
>
> :) Trite but True.
Mind you further to this, I would be amenable to start to instigate
this change if you didnt have to manually enumerate the usage (--help)
option in getopt_long meaning you are more prone to error and/or not
keeping things up to data ala Perl POD. Add to that that you also have
to manually set variables from what I can see meaning even more code
for each MINC tool.
ie: (from uname.c).
....
static struct option const long_options[] =
{
{"all", no_argument, NULL, 'a'},
{"kernel-name", no_argument, NULL, 's'},
{"sysname", no_argument, NULL, 's'}, /* Obsolescent. */
{"nodename", no_argument, NULL, 'n'},
{"kernel-release", no_argument, NULL, 'r'},
{"release", no_argument, NULL, 'r'}, /* Obsolescent. */
{"kernel-version", no_argument, NULL, 'v'},
{"machine", no_argument, NULL, 'm'},
{"processor", no_argument, NULL, 'p'},
{"hardware-platform", no_argument, NULL, 'i'},
{"operating-system", no_argument, NULL, 'o'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
...
void
usage (int status)
{
if (status != 0)
fprintf (stderr, _("Try `%s --help' for more information.\n"),
program_name);
else
{
printf (_("Usage: %s [OPTION]...\n"), program_name);
fputs (_("\
Print certain system information. With no OPTION, same as -s.\n\
\n\
-a, --all print all information, in the following order:\n\
-s, --kernel-name print the kernel name\n\
-n, --nodename print the network node hostname\n\
-r, --kernel-release print the kernel release\n\
"), stdout);
fputs (_("\
-v, --kernel-version print the kernel version\n\
-m, --machine print the machine hardware name\n\
-p, --processor print the processor type\n\
-i, --hardware-platform print the hardware platform\n\
-o, --operating-system print the operating system\n\
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
}
exit (status);
}
...
a
More information about the MINC-development
mailing list