Blame gettext-tools/gnulib-lib/getopt_int.h

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