Blame posix/getopt_int.h

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