Blame support/getopt_int.h

Packit 575503
/* Internal declarations for getopt.
Packit 575503
   Copyright (C) 1989-2016 Free Software Foundation, Inc.
Packit 575503
   This file is part of the GNU C Library.
Packit 575503
Packit 575503
   The GNU C Library is free software; you can redistribute it and/or
Packit 575503
   modify it under the terms of the GNU Lesser General Public
Packit 575503
   License as published by the Free Software Foundation; either
Packit 575503
   version 2.1 of the License, or (at your option) any later version.
Packit 575503
Packit 575503
   The GNU C Library is distributed in the hope that it will be useful,
Packit 575503
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 575503
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 575503
   Lesser General Public License for more details.
Packit 575503
Packit 575503
   You should have received a copy of the GNU Lesser General Public
Packit 575503
   License along with the GNU C Library; if not, see
Packit 575503
   <http://www.gnu.org/licenses/>.  */
Packit 575503
Packit 575503
#ifndef _GETOPT_INT_H
Packit 575503
#define _GETOPT_INT_H	1
Packit 575503
Packit 575503
extern int _getopt_internal (int ___argc, char *const *___argv,
Packit 575503
			     const char *__shortopts,
Packit 575503
		             const struct option *__longopts, int *__longind,
Packit 575503
			     int __long_only, int posixly_correct);
Packit 575503
Packit 575503

Packit 575503
/* Reentrant versions which can handle parsing multiple argument
Packit 575503
   vectors at the same time.  */
Packit 575503
Packit 575503
/* Data type for reentrant functions.  */
Packit 575503
struct _getopt_data
Packit 575503
{
Packit 575503
  /* These have exactly the same meaning as the corresponding global
Packit 575503
     variables, except that they are used for the reentrant
Packit 575503
     versions of getopt.  */
Packit 575503
  int optind;
Packit 575503
  int opterr;
Packit 575503
  int optopt;
Packit 575503
  char *optarg;
Packit 575503
Packit 575503
  /* Internal members.  */
Packit 575503
Packit 575503
  /* True if the internal members have been initialized.  */
Packit 575503
  int __initialized;
Packit 575503
Packit 575503
  /* The next char to be scanned in the option-element
Packit 575503
     in which the last option character we returned was found.
Packit 575503
     This allows us to pick up the scan where we left off.
Packit 575503
Packit 575503
     If this is zero, or a null string, it means resume the scan
Packit 575503
     by advancing to the next ARGV-element.  */
Packit 575503
  char *__nextchar;
Packit 575503
Packit 575503
  /* Describe how to deal with options that follow non-option ARGV-elements.
Packit 575503
Packit 575503
     If the caller did not specify anything,
Packit 575503
     the default is REQUIRE_ORDER if the environment variable
Packit 575503
     POSIXLY_CORRECT is defined, PERMUTE otherwise.
Packit 575503
Packit 575503
     REQUIRE_ORDER means don't recognize them as options;
Packit 575503
     stop option processing when the first non-option is seen.
Packit 575503
     This is what Unix does.
Packit 575503
     This mode of operation is selected by either setting the environment
Packit 575503
     variable POSIXLY_CORRECT, or using `+' as the first character
Packit 575503
     of the list of option characters.
Packit 575503
Packit 575503
     PERMUTE is the default.  We permute the contents of ARGV as we
Packit 575503
     scan, so that eventually all the non-options are at the end.
Packit 575503
     This allows options to be given in any order, even with programs
Packit 575503
     that were not written to expect this.
Packit 575503
Packit 575503
     RETURN_IN_ORDER is an option available to programs that were
Packit 575503
     written to expect options and other ARGV-elements in any order
Packit 575503
     and that care about the ordering of the two.  We describe each
Packit 575503
     non-option ARGV-element as if it were the argument of an option
Packit 575503
     with character code 1.  Using `-' as the first character of the
Packit 575503
     list of option characters selects this mode of operation.
Packit 575503
Packit 575503
     The special argument `--' forces an end of option-scanning regardless
Packit 575503
     of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
Packit 575503
     `--' can cause `getopt' to return -1 with `optind' != ARGC.  */
Packit 575503
Packit 575503
  enum
Packit 575503
    {
Packit 575503
      REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
Packit 575503
    } __ordering;
Packit 575503
Packit 575503
  /* If the POSIXLY_CORRECT environment variable is set.  */
Packit 575503
  int __posixly_correct;
Packit 575503
Packit 575503
Packit 575503
  /* Handle permutation of arguments.  */
Packit 575503
Packit 575503
  /* Describe the part of ARGV that contains non-options that have
Packit 575503
     been skipped.  `first_nonopt' is the index in ARGV of the first
Packit 575503
     of them; `last_nonopt' is the index after the last of them.  */
Packit 575503
Packit 575503
  int __first_nonopt;
Packit 575503
  int __last_nonopt;
Packit 575503
Packit 575503
#if defined _LIBC && defined USE_NONOPTION_FLAGS
Packit 575503
  int __nonoption_flags_max_len;
Packit 575503
  int __nonoption_flags_len;
Packit 575503
# endif
Packit 575503
};
Packit 575503
Packit 575503
/* The initializer is necessary to set OPTIND and OPTERR to their
Packit 575503
   default values and to clear the initialization flag.  */
Packit 575503
#define _GETOPT_DATA_INITIALIZER	{ 1, 1 }
Packit 575503
Packit 575503
extern int _getopt_internal_r (int ___argc, char *const *___argv,
Packit 575503
			       const char *__shortopts,
Packit 575503
			       const struct option *__longopts, int *__longind,
Packit 575503
			       int __long_only, struct _getopt_data *__data,
Packit 575503
			       int posixly_correct);
Packit 575503
Packit 575503
extern int _getopt_long_r (int ___argc, char *const *___argv,
Packit 575503
			   const char *__shortopts,
Packit 575503
			   const struct option *__longopts, int *__longind,
Packit 575503
			   struct _getopt_data *__data);
Packit 575503
Packit 575503
extern int _getopt_long_only_r (int ___argc, char *const *___argv,
Packit 575503
				const char *__shortopts,
Packit 575503
				const struct option *__longopts,
Packit 575503
				int *__longind,
Packit 575503
				struct _getopt_data *__data);
Packit 575503
Packit 575503
#endif /* getopt_int.h */