/* 1003.2 says this must be 1 before any call. */
static int GNoptind = 1;
-/* Formerly, initialization of getopt depended on GNoptind==0, which
- causes problems with re-calling getopt as programs generally don't
- know that. */
-
-static int __getopt_initialized = 0;
-
/* The next char to be scanned in the option-element
in which the last option character we returned was found.
This allows us to pick up the scan where we left off.
static char *nextchar;
-/* Callers store zero here to inhibit the error message
- for unrecognized options. */
-
-static int GNopterr = 1;
-
-/* Set to an option character which was unrecognized.
- This must be initialized on some systems to avoid linking in the
- system's own getopt implementation. */
-
-static int GNoptopt = '?';
/* Describe how to deal with options that follow non-option ARGV-elements.
long-named options. */
static int
-GN_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
- int argc;
- char *const *argv;
- const char *optstring;
- const struct GNoption *longopts;
- int *longind;
- int long_only;
+GN_getopt_internal (int argc,
+ char *const *argv,
+ const char *optstring,
+ const struct GNoption *longopts,
+ int *longind,
+ int long_only)
{
+ static int __getopt_initialized = 0;
+ static int GNopterr = 1;
+ static int GNoptopt = '?';
+
GNoptarg = NULL;
if (GNoptind == 0 || !__getopt_initialized)
/* Test all long options for either exact match
or abbreviated matches. */
+ if (longopts != NULL)
for (p = longopts, option_index = 0; p->name; p++, option_index++)
if (!strncmp (p->name, nextchar, nameend - nextchar))
{
/**
* Parse the command line.
*
- * @param binaryOptions name of this binary / application
+ * @param binaryOptions Name of application with option summary
* @param allOptions defined options and handlers
* @param argc number of arguments
* @param argv actual arguments
long_options[count].has_arg = 0;
long_options[count].flag = NULL;
long_options[count].val = '\0';
- shorts[spos++] = '\0';
+ shorts[spos] = '\0';
cont = GNUNET_OK;
/* main getopt loop */
while (cont == GNUNET_OK)