Blame src/getopt_int.h

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