Blame lib/getopt_int.h

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