(root)/
gettext-0.22.4/
gettext-runtime/
gnulib-lib/
getopt-core.h
       1  /* Declarations for getopt (basic, portable features only).
       2     Copyright (C) 1989-2023 Free Software Foundation, Inc.
       3     This file is part of the GNU C Library and is also part of gnulib.
       4     Patches to this file should be submitted to both projects.
       5  
       6     The GNU C Library is free software; you can redistribute it and/or
       7     modify it under the terms of the GNU Lesser General Public
       8     License as published by the Free Software Foundation; either
       9     version 2.1 of the License, or (at your option) any later version.
      10  
      11     The GNU C Library is distributed in the hope that it will be useful,
      12     but WITHOUT ANY WARRANTY; without even the implied warranty of
      13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      14     Lesser General Public License for more details.
      15  
      16     You should have received a copy of the GNU Lesser General Public
      17     License along with the GNU C Library; if not, see
      18     <https://www.gnu.org/licenses/>.  */
      19  
      20  #ifndef _GETOPT_CORE_H
      21  #define _GETOPT_CORE_H 1
      22  
      23  /* Ensure that DLL_VARIABLE is defined.  Since on OSF/1 4.0 and Irix 6.5
      24     <stdlib.h> includes <getopt.h>, and <config.h> is not a prerequisite for
      25     using <stdlib.h>, this file can be included without a prior
      26     "#include <config.h>".  */
      27  #if !defined DLL_VARIABLE && defined HAVE_CONFIG_H
      28  # include <config.h>
      29  #endif
      30  
      31  /* This header should not be used directly; include getopt.h or
      32     unistd.h instead.  Unlike most bits headers, it does not have
      33     a protective #error, because the guard macro for getopt.h in
      34     gnulib is not fixed.  */
      35  
      36  __BEGIN_DECLS
      37  
      38  /* For communication from 'getopt' to the caller.
      39     When 'getopt' finds an option that takes an argument,
      40     the argument value is returned here.
      41     Also, when 'ordering' is RETURN_IN_ORDER,
      42     each non-option ARGV-element is returned here.  */
      43  
      44  extern DLL_VARIABLE char *optarg;
      45  
      46  /* Index in ARGV of the next element to be scanned.
      47     This is used for communication to and from the caller
      48     and for communication between successive calls to 'getopt'.
      49  
      50     On entry to 'getopt', zero means this is the first call; initialize.
      51  
      52     When 'getopt' returns -1, this is the index of the first of the
      53     non-option elements that the caller should itself scan.
      54  
      55     Otherwise, 'optind' communicates from one call to the next
      56     how much of ARGV has been scanned so far.  */
      57  
      58  extern DLL_VARIABLE int optind;
      59  
      60  /* Callers store zero here to inhibit the error message 'getopt' prints
      61     for unrecognized options.  */
      62  
      63  extern DLL_VARIABLE int opterr;
      64  
      65  /* Set to an option character which was unrecognized.  */
      66  
      67  extern DLL_VARIABLE int optopt;
      68  
      69  /* Get definitions and prototypes for functions to process the
      70     arguments in ARGV (ARGC of them, minus the program name) for
      71     options given in OPTS.
      72  
      73     Return the option character from OPTS just read.  Return -1 when
      74     there are no more options.  For unrecognized options, or options
      75     missing arguments, 'optopt' is set to the option letter, and '?' is
      76     returned.
      77  
      78     The OPTS string is a list of characters which are recognized option
      79     letters, optionally followed by colons, specifying that that letter
      80     takes an argument, to be placed in 'optarg'.
      81  
      82     If a letter in OPTS is followed by two colons, its argument is
      83     optional.  This behavior is specific to the GNU 'getopt'.
      84  
      85     The argument '--' causes premature termination of argument
      86     scanning, explicitly telling 'getopt' that there are no more
      87     options.
      88  
      89     If OPTS begins with '-', then non-option arguments are treated as
      90     arguments to the option '\1'.  This behavior is specific to the GNU
      91     'getopt'.  If OPTS begins with '+', or POSIXLY_CORRECT is set in
      92     the environment, then do not permute arguments.
      93  
      94     For standards compliance, the 'argv' argument has the type
      95     char *const *, but this is inaccurate; if argument permutation is
      96     enabled, the argv array (not the strings it points to) must be
      97     writable.  */
      98  
      99  extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
     100         __THROW _GL_ARG_NONNULL ((2, 3));
     101  
     102  __END_DECLS
     103  
     104  #endif /* _GETOPT_CORE_H */