Lines Matching refs:argv
98 As `getopt' works, it permutes the elements of ARGV so that,
114 each non-option ARGV-element is returned here. */
118 /* Index in ARGV of the next element to be scanned.
128 how much of ARGV has been scanned so far. */
144 by advancing to the next ARGV-element. */
159 /* Describe how to deal with options that follow non-option ARGV-elements.
172 PERMUTE is the default. We permute the contents of ARGV as we scan,
178 to expect options and other ARGV-elements in any order and that care about
179 the ordering of the two. We describe each non-option ARGV-element
250 /* Describe the part of ARGV that contains non-options that have
251 been skipped. `first_nonopt' is the index in ARGV of the first of them;
259 indicating ARGV elements that should not be considered arguments. */
271 is valid for the getopt call we must make sure that the ARGV passed
275 store_args_and_env (int argc, char *const *argv)
280 original_argv = argv;
297 /* Exchange two adjacent subsequences of ARGV.
304 the new indices of the non-options in ARGV after they are moved. */
311 exchange (argv)
312 char **argv;
357 tem = argv[bottom + i];
358 argv[bottom + i] = argv[top - (middle - bottom) + i];
359 argv[top - (middle - bottom) + i] = tem;
374 tem = argv[bottom + i];
375 argv[bottom + i] = argv[middle + i];
376 argv[middle + i] = tem;
396 _getopt_initialize (argc, argv, optstring)
398 char *const *argv;
401 /* Start processing options with ARGV-element 1 (since ARGV-element 0
403 non-option ARGV-elements is empty. */
430 && argc == original_argc && argv == original_argv)
462 /* Scan elements of ARGV (whose length is ARGC) for option characters
465 If an element of ARGV starts with '-', and is not exactly "-" or "--",
473 resume the scan with the following option character or ARGV-element.
476 Then `optind' is the index in ARGV of the first ARGV-element
477 that is not an option. (The ARGV-elements have been permuted
486 so the following text in the same ARGV-element, or the text of the following
487 ARGV-element, is returned in `optarg'. Two colons mean an option that
488 wants an optional arg; if there is text in the current ARGV-element,
492 handling the non-option ARGV-elements.
498 argument, it follows the option name in the same ARGV-element, separated
499 from the option name by a `=', or else the in next ARGV-element.
504 The elements of ARGV aren't really const, because we permute them.
519 _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
521 char *const *argv;
532 optind = 1; /* Don't scan ARGV[0], the program name. */
533 optstring = _getopt_initialize (argc, argv, optstring);
537 /* Test whether ARGV[optind] points to a non-option argument.
542 # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \
546 # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
551 /* Advance to the next ARGV-element. */
566 exchange ((char **) argv);
578 /* The special ARGV-element `--' means premature end of options.
583 if (optind != argc && !strcmp (argv[optind], "--"))
588 exchange ((char **) argv);
596 /* If we have done all the ARGV-elements, stop the scan
615 optarg = argv[optind++];
619 /* We have found another option-ARGV-element.
622 nextchar = (argv[optind] + 1
623 + (longopts != NULL && argv[optind][1] == '-'));
626 /* Decode the current option-ARGV-element. */
628 /* Check whether the ARGV-element is a long option.
630 If long_only and the ARGV-element has the form "-f", where f is
636 the ARGV-element is "-fu", do consider that an abbreviation of
642 && (argv[optind][1] == '-'
643 || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
685 argv[0], argv[optind]);
706 if (argv[optind - 1][1] == '-')
710 argv[0], pfound->name);
715 argv[0], argv[optind - 1][0], pfound->name);
726 optarg = argv[optind++];
732 argv[0], argv[optind - 1]);
753 if (!long_only || argv[optind][1] == '-'
758 if (argv[optind][1] == '-')
761 argv[0], nextchar);
765 argv[0], argv[optind][0], nextchar);
791 argv[0], c);
794 argv[0], c);
814 /* If we end this ARGV-element by taking the rest as an arg,
824 argv[0], c);
835 increment it again when taking next ARGV-elt as argument. */
836 optarg = argv[optind++];
871 argv[0], argv[optind]);
890 argv[0], pfound->name);
899 optarg = argv[optind++];
905 argv[0], argv[optind - 1]);
943 /* If we end this ARGV-element by taking the rest as an arg,
954 argv[0], c);
964 increment it again when taking next ARGV-elt as argument. */
965 optarg = argv[optind++];
974 getopt (argc, argv, optstring)
976 char *const *argv;
979 return _getopt_internal (argc, argv, optstring,
994 main (argc, argv)
996 char **argv;
1005 c = getopt (argc, argv, "abc:d:0123456789");
1022 printf ("digits occur in two different argv-elements.\n");
1049 printf ("non-option ARGV-elements: ");
1051 printf ("%s ", argv[optind++]);