Blame gnulib/getopt_int.h

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