Lines Matching full:argv
52 As `getopt_long' works, it permutes the elements of ARGV so that,
69 each non-option ARGV-element is returned here. */
73 /* Index in ARGV of the next element to be scanned.
83 how much of ARGV has been scanned so far. */
118 indicating ARGV elements that should not be considered arguments. */
140 /* Exchange two adjacent subsequences of ARGV.
147 the new indices of the non-options in ARGV after they are moved. */
150 exchange (char **argv, struct _getopt_data *d)
195 tem = argv[bottom + i];
196 argv[bottom + i] = argv[top - (middle - bottom) + i];
197 argv[top - (middle - bottom) + i] = tem;
212 tem = argv[bottom + i];
213 argv[bottom + i] = argv[middle + i];
214 argv[middle + i] = tem;
231 _getopt_initialize (int argc, char **argv, const char *optstring,
234 /* Start processing options with ARGV-element 1 (since ARGV-element 0
236 non-option ARGV-elements is empty. */
263 && argc == __libc_argc && argv == __libc_argv)
295 /* Scan elements of ARGV (whose length is ARGC) for option characters
298 If an element of ARGV starts with '-', and is not exactly "-" or "--",
306 resume the scan with the following option character or ARGV-element.
309 Then `optind' is the index in ARGV of the first ARGV-element
310 that is not an option. (The ARGV-elements have been permuted
319 so the following text in the same ARGV-element, or the text of the following
320 ARGV-element, is returned in `optarg'. Two colons mean an option that
321 wants an optional arg; if there is text in the current ARGV-element,
325 handling the non-option ARGV-elements.
331 argument, it follows the option name in the same ARGV-element, separated
332 from the option name by a `=', or else the in next ARGV-element.
351 _getopt_internal_r (int argc, char **argv, const char *optstring,
367 d->optind = 1; /* Don't scan ARGV[0], the program name. */
368 optstring = _getopt_initialize (argc, argv, optstring,
373 /* Test whether ARGV[optind] points to a non-option argument.
378 # define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0' \
382 # define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0')
387 /* Advance to the next ARGV-element. */
403 exchange ((char **) argv, d);
415 /* The special ARGV-element `--' means premature end of options.
420 if (d->optind != argc && !strcmp (argv[d->optind], "--"))
426 exchange ((char **) argv, d);
434 /* If we have done all the ARGV-elements, stop the scan
453 d->optarg = argv[d->optind++];
457 /* We have found another option-ARGV-element.
460 d->__nextchar = (argv[d->optind] + 1
461 + (longopts != NULL && argv[d->optind][1] == '-'));
464 /* Decode the current option-ARGV-element. */
466 /* Check whether the ARGV-element is a long option.
468 If long_only and the ARGV-element has the form "-f", where f is
474 the ARGV-element is "-fu", do consider that an abbreviation of
480 && (argv[d->optind][1] == '-'
481 || (long_only && (argv[d->optind][2]
482 || !strchr (optstring, argv[d->optind][1])))))
531 argv[0], argv[d->optind]) >= 0)
547 argv[0], argv[d->optind]);
575 if (argv[d->optind - 1][1] == '-')
581 argv[0], pfound->name);
585 argv[0], pfound->name);
594 argv[0], argv[d->optind - 1][0],
599 argv[0], argv[d->optind - 1][0],
632 d->optarg = argv[d->optind++];
642 argv[0], argv[d->optind - 1]) >= 0)
660 argv[0], argv[d->optind - 1]);
683 if (!long_only || argv[d->optind][1] == '-'
693 if (argv[d->optind][1] == '-')
698 argv[0], d->__nextchar);
701 argv[0], d->__nextchar);
709 argv[0], argv[d->optind][0], d->__nextchar);
712 argv[0], argv[d->optind][0], d->__nextchar);
764 argv[0], c);
766 fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c);
773 argv[0], c);
775 fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c);
814 /* If we end this ARGV-element by taking the rest as an arg,
828 argv[0], c) >= 0)
844 argv[0], c);
856 increment it again when taking next ARGV-elt as argument. */
857 d->optarg = argv[d->optind++];
897 argv[0], argv[d->optind]) >= 0)
913 argv[0], argv[d->optind]);
938 argv[0], pfound->name) >= 0)
956 argv[0], pfound->name);
967 d->optarg = argv[d->optind++];
977 argv[0], argv[d->optind - 1]) >= 0)
995 argv[0], argv[d->optind - 1]);
1035 /* If we end this ARGV-element by taking the rest as an arg,
1049 argv[0], c) >= 0)
1066 argv[0], c);
1077 increment it again when taking next ARGV-elt as argument. */
1078 d->optarg = argv[d->optind++];
1087 _getopt_internal (int argc, char **argv, const char *optstring,
1096 result = _getopt_internal_r (argc, argv, optstring, longopts, longind,
1115 getopt (int argc, char *const *argv, const char *optstring)
1117 return _getopt_internal (argc, (char **) argv, optstring, NULL, NULL, 0,
1129 main (int argc, char **argv)
1138 c = getopt (argc, argv, "abc:d:0123456789");
1155 printf ("digits occur in two different argv-elements.\n");
1182 printf ("non-option ARGV-elements: ");
1184 printf ("%s ", argv[optind++]);