Blame lib/getopt-core.h

Packit 33f14e
/* Declarations for getopt (basic, portable features only).
Packit 33f14e
   Copyright (C) 1989-2017 Free Software Foundation, Inc.
Packit 33f14e
   This file is part of the GNU C Library and is also part of gnulib.
Packit 33f14e
   Patches to this file should be submitted to both projects.
Packit 33f14e
Packit 33f14e
   The GNU C Library is free software; you can redistribute it and/or
Packit 33f14e
   modify it under the terms of the GNU General Public
Packit 33f14e
   License as published by the Free Software Foundation; either
Packit 33f14e
   version 3 of the License, or (at your option) any later version.
Packit 33f14e
Packit 33f14e
   The GNU C Library is distributed in the hope that it will be useful,
Packit 33f14e
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 33f14e
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 33f14e
   General Public License for more details.
Packit 33f14e
Packit 33f14e
   You should have received a copy of the GNU General Public
Packit 33f14e
   License along with the GNU C Library; if not, see
Packit 33f14e
   <http://www.gnu.org/licenses/>.  */
Packit 33f14e
Packit 33f14e
#ifndef _GETOPT_CORE_H
Packit 33f14e
#define _GETOPT_CORE_H 1
Packit 33f14e
Packit 33f14e
/* This header should not be used directly; include getopt.h or
Packit 33f14e
   unistd.h instead.  Unlike most bits headers, it does not have
Packit 33f14e
   a protective #error, because the guard macro for getopt.h in
Packit 33f14e
   gnulib is not fixed.  */
Packit 33f14e
Packit 33f14e
__BEGIN_DECLS
Packit 33f14e
Packit 33f14e
/* For communication from 'getopt' to the caller.
Packit 33f14e
   When 'getopt' finds an option that takes an argument,
Packit 33f14e
   the argument value is returned here.
Packit 33f14e
   Also, when 'ordering' is RETURN_IN_ORDER,
Packit 33f14e
   each non-option ARGV-element is returned here.  */
Packit 33f14e
Packit 33f14e
extern char *optarg;
Packit 33f14e
Packit 33f14e
/* Index in ARGV of the next element to be scanned.
Packit 33f14e
   This is used for communication to and from the caller
Packit 33f14e
   and for communication between successive calls to 'getopt'.
Packit 33f14e
Packit 33f14e
   On entry to 'getopt', zero means this is the first call; initialize.
Packit 33f14e
Packit 33f14e
   When 'getopt' returns -1, this is the index of the first of the
Packit 33f14e
   non-option elements that the caller should itself scan.
Packit 33f14e
Packit 33f14e
   Otherwise, 'optind' communicates from one call to the next
Packit 33f14e
   how much of ARGV has been scanned so far.  */
Packit 33f14e
Packit 33f14e
extern int optind;
Packit 33f14e
Packit 33f14e
/* Callers store zero here to inhibit the error message 'getopt' prints
Packit 33f14e
   for unrecognized options.  */
Packit 33f14e
Packit 33f14e
extern int opterr;
Packit 33f14e
Packit 33f14e
/* Set to an option character which was unrecognized.  */
Packit 33f14e
Packit 33f14e
extern int optopt;
Packit 33f14e
Packit 33f14e
/* Get definitions and prototypes for functions to process the
Packit 33f14e
   arguments in ARGV (ARGC of them, minus the program name) for
Packit 33f14e
   options given in OPTS.
Packit 33f14e
Packit 33f14e
   Return the option character from OPTS just read.  Return -1 when
Packit 33f14e
   there are no more options.  For unrecognized options, or options
Packit 33f14e
   missing arguments, 'optopt' is set to the option letter, and '?' is
Packit 33f14e
   returned.
Packit 33f14e
Packit 33f14e
   The OPTS string is a list of characters which are recognized option
Packit 33f14e
   letters, optionally followed by colons, specifying that that letter
Packit 33f14e
   takes an argument, to be placed in 'optarg'.
Packit 33f14e
Packit 33f14e
   If a letter in OPTS is followed by two colons, its argument is
Packit 33f14e
   optional.  This behavior is specific to the GNU 'getopt'.
Packit 33f14e
Packit 33f14e
   The argument '--' causes premature termination of argument
Packit 33f14e
   scanning, explicitly telling 'getopt' that there are no more
Packit 33f14e
   options.
Packit 33f14e
Packit 33f14e
   If OPTS begins with '-', then non-option arguments are treated as
Packit 33f14e
   arguments to the option '\1'.  This behavior is specific to the GNU
Packit 33f14e
   'getopt'.  If OPTS begins with '+', or POSIXLY_CORRECT is set in
Packit 33f14e
   the environment, then do not permute arguments.
Packit 33f14e
Packit 33f14e
   For standards compliance, the 'argv' argument has the type
Packit 33f14e
   char *const *, but this is inaccurate; if argument permutation is
Packit 33f14e
   enabled, the argv array (not the strings it points to) must be
Packit 33f14e
   writable.  */
Packit 33f14e
Packit 33f14e
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
Packit 33f14e
       __THROW _GL_ARG_NONNULL ((2, 3));
Packit 33f14e
Packit 33f14e
__END_DECLS
Packit 33f14e
Packit 33f14e
#endif /* _GETOPT_CORE_H */