Blame posix/bits/getopt_core.h

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