Blame lib/getopt-ext.h

Packit Service fdd496
/* Declarations for getopt (GNU extensions).
Packit Service fdd496
   Copyright (C) 1989-2017 Free Software Foundation, Inc.
Packit Service fdd496
   This file is part of the GNU C Library and is also part of gnulib.
Packit Service fdd496
   Patches to this file should be submitted to both projects.
Packit Service fdd496
Packit Service fdd496
   The GNU C Library is free software; you can redistribute it and/or
Packit Service fdd496
   modify it under the terms of the GNU General Public
Packit Service fdd496
   License as published by the Free Software Foundation; either
Packit Service fdd496
   version 3 of the License, or (at your option) any later version.
Packit Service fdd496
Packit Service fdd496
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service fdd496
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service fdd496
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service fdd496
   General Public License for more details.
Packit Service fdd496
Packit Service fdd496
   You should have received a copy of the GNU General Public
Packit Service fdd496
   License along with the GNU C Library; if not, see
Packit Service fdd496
   <http://www.gnu.org/licenses/>.  */
Packit Service fdd496
Packit Service fdd496
#ifndef _GETOPT_EXT_H
Packit Service fdd496
#define _GETOPT_EXT_H 1
Packit Service fdd496
Packit Service fdd496
/* This header should not be used directly; include getopt.h instead.
Packit Service fdd496
   Unlike most bits headers, it does not have a protective #error,
Packit Service fdd496
   because the guard macro for getopt.h in gnulib is not fixed.  */
Packit Service fdd496
Packit Service fdd496
__BEGIN_DECLS
Packit Service fdd496
Packit Service fdd496
/* Describe the long-named options requested by the application.
Packit Service fdd496
   The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
Packit Service fdd496
   of 'struct option' terminated by an element containing a name which is
Packit Service fdd496
   zero.
Packit Service fdd496
Packit Service fdd496
   The field 'has_arg' is:
Packit Service fdd496
   no_argument		(or 0) if the option does not take an argument,
Packit Service fdd496
   required_argument	(or 1) if the option requires an argument,
Packit Service fdd496
   optional_argument 	(or 2) if the option takes an optional argument.
Packit Service fdd496
Packit Service fdd496
   If the field 'flag' is not NULL, it points to a variable that is set
Packit Service fdd496
   to the value given in the field 'val' when the option is found, but
Packit Service fdd496
   left unchanged if the option is not found.
Packit Service fdd496
Packit Service fdd496
   To have a long-named option do something other than set an 'int' to
Packit Service fdd496
   a compiled-in constant, such as set a value from 'optarg', set the
Packit Service fdd496
   option's 'flag' field to zero and its 'val' field to a nonzero
Packit Service fdd496
   value (the equivalent single-letter option character, if there is
Packit Service fdd496
   one).  For long options that have a zero 'flag' field, 'getopt'
Packit Service fdd496
   returns the contents of the 'val' field.  */
Packit Service fdd496
Packit Service fdd496
struct option
Packit Service fdd496
{
Packit Service fdd496
  const char *name;
Packit Service fdd496
  /* has_arg can't be an enum because some compilers complain about
Packit Service fdd496
     type mismatches in all the code that assumes it is an int.  */
Packit Service fdd496
  int has_arg;
Packit Service fdd496
  int *flag;
Packit Service fdd496
  int val;
Packit Service fdd496
};
Packit Service fdd496
Packit Service fdd496
/* Names for the values of the 'has_arg' field of 'struct option'.  */
Packit Service fdd496
Packit Service fdd496
#define no_argument		0
Packit Service fdd496
#define required_argument	1
Packit Service fdd496
#define optional_argument	2
Packit Service fdd496
Packit Service fdd496
extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,
Packit Service fdd496
			const char *__shortopts,
Packit Service fdd496
		        const struct option *__longopts, int *__longind)
Packit Service fdd496
       __THROW _GL_ARG_NONNULL ((2, 3));
Packit Service fdd496
extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv,
Packit Service fdd496
			     const char *__shortopts,
Packit Service fdd496
		             const struct option *__longopts, int *__longind)
Packit Service fdd496
       __THROW _GL_ARG_NONNULL ((2, 3));
Packit Service fdd496
Packit Service fdd496
__END_DECLS
Packit Service fdd496
Packit Service fdd496
#endif /* _GETOPT_EXT_H */