Blame src/getopt_int.h

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