Blame gnulib/lib/getopt-core.h

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