Home | History | Annotate | Download | only in lib

Lines Matching refs:argv

57    As `getopt_long' works, it permutes the elements of ARGV so that,
74 each non-option ARGV-element is returned here. */
78 /* Index in ARGV of the next element to be scanned.
88 how much of ARGV has been scanned so far. */
123 indicating ARGV elements that should not be considered arguments. */
145 /* Exchange two adjacent subsequences of ARGV.
152 the new indices of the non-options in ARGV after they are moved. */
155 exchange (char **argv, struct _getopt_data *d)
200 tem = argv[bottom + i];
201 argv[bottom + i] = argv[top - (middle - bottom) + i];
202 argv[top - (middle - bottom) + i] = tem;
217 tem = argv[bottom + i];
218 argv[bottom + i] = argv[middle + i];
219 argv[middle + i] = tem;
236 _getopt_initialize (int argc, char **argv, const char *optstring,
239 /* Start processing options with ARGV-element 1 (since ARGV-element 0
241 non-option ARGV-elements is empty. */
268 && argc == __libc_argc && argv == __libc_argv)
300 /* Scan elements of ARGV (whose length is ARGC) for option characters
303 If an element of ARGV starts with '-', and is not exactly "-" or "--",
311 resume the scan with the following option character or ARGV-element.
314 Then `optind' is the index in ARGV of the first ARGV-element
315 that is not an option. (The ARGV-elements have been permuted
324 so the following text in the same ARGV-element, or the text of the following
325 ARGV-element, is returned in `optarg'. Two colons mean an option that
326 wants an optional arg; if there is text in the current ARGV-element,
330 handling the non-option ARGV-elements.
336 argument, it follows the option name in the same ARGV-element, separated
337 from the option name by a `=', or else the in next ARGV-element.
356 _getopt_internal_r (int argc, char **argv, const char *optstring,
372 d->optind = 1; /* Don't scan ARGV[0], the program name. */
373 optstring = _getopt_initialize (argc, argv, optstring,
378 /* Test whether ARGV[optind] points to a non-option argument.
383 # define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0' \
387 # define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0')
392 /* Advance to the next ARGV-element. */
408 exchange ((char **) argv, d);
420 /* The special ARGV-element `--' means premature end of options.
425 if (d->optind != argc && !strcmp (argv[d->optind], "--"))
431 exchange ((char **) argv, d);
439 /* If we have done all the ARGV-elements, stop the scan
458 d->optarg = argv[d->optind++];
462 /* We have found another option-ARGV-element.
465 d->__nextchar = (argv[d->optind] + 1
466 + (longopts != NULL && argv[d->optind][1] == '-'));
469 /* Decode the current option-ARGV-element. */
471 /* Check whether the ARGV-element is a long option.
473 If long_only and the ARGV-element has the form "-f", where f is
479 the ARGV-element is "-fu", do consider that an abbreviation of
485 && (argv[d->optind][1] == '-'
486 || (long_only && (argv[d->optind][2]
487 || !strchr (optstring, argv[d->optind][1])))))
536 argv[0], argv[d->optind]) >= 0)
552 argv[0], argv[d->optind]);
580 if (argv[d->optind - 1][1] == '-')
586 argv[0], pfound->name);
590 argv[0], pfound->name);
599 argv[0], argv[d->optind - 1][0],
604 argv[0], argv[d->optind - 1][0],
637 d->optarg = argv[d->optind++];
647 argv[0], argv[d->optind - 1]) >= 0)
665 argv[0], argv[d->optind - 1]);
688 if (!long_only || argv[d->optind][1] == '-'
698 if (argv[d->optind][1] == '-')
703 argv[0], d->__nextchar);
706 argv[0], d->__nextchar);
714 argv[0], argv[d->optind][0], d->__nextchar);
717 argv[0], argv[d->optind][0], d->__nextchar);
769 argv[0], c);
771 fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c);
778 argv[0], c);
780 fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c);
819 /* If we end this ARGV-element by taking the rest as an arg,
833 argv[0], c) >= 0)
849 argv[0], c);
861 increment it again when taking next ARGV-elt as argument. */
862 d->optarg = argv[d->optind++];
902 argv[0], argv[d->optind]) >= 0)
918 argv[0], argv[d->optind]);
943 argv[0], pfound->name) >= 0)
961 argv[0], pfound->name);
972 d->optarg = argv[d->optind++];
982 argv[0], argv[d->optind - 1]) >= 0)
1000 argv[0], argv[d->optind - 1]);
1040 /* If we end this ARGV-element by taking the rest as an arg,
1054 argv[0], c) >= 0)
1071 argv[0], c);
1082 increment it again when taking next ARGV-elt as argument. */
1083 d->optarg = argv[d->optind++];
1092 _getopt_internal (int argc, char **argv, const char *optstring,
1101 result = _getopt_internal_r (argc, argv, optstring, longopts, longind,
1120 getopt (int argc, char *const *argv, const char *optstring)
1122 return _getopt_internal (argc, (char **) argv, optstring, NULL, NULL, 0,
1134 main (int argc, char **argv)
1143 c = getopt (argc, argv, "abc:d:0123456789");
1160 printf ("digits occur in two different argv-elements.\n");
1187 printf ("non-option ARGV-elements: ");
1189 printf ("%s ", argv[optind++]);