Blame lib/getopt_int.h

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