Blame posix/getopt_int.h

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