Blame lib/getopt-pfx-ext.h

Packit 709fb3
/* getopt (GNU extensions) gnulib wrapper header.
Packit 709fb3
   Copyright (C) 1989-2017 Free Software Foundation, Inc.
Packit 709fb3
   This file is part of gnulib.
Packit 709fb3
   Unlike most of the getopt implementation, it is NOT shared
Packit 709fb3
   with the GNU C Library.
Packit 709fb3
Packit 709fb3
   gnulib is free software; you can redistribute it and/or modify it
Packit 709fb3
   under the terms of the GNU General Public License as
Packit 709fb3
   published by the Free Software Foundation; either version 3 of
Packit 709fb3
   the License, or (at your option) any later version.
Packit 709fb3
Packit 709fb3
   gnulib is distributed in the hope that it will be useful, but
Packit 709fb3
   WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 709fb3
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 709fb3
   General Public License for more details.
Packit 709fb3
Packit 709fb3
   You should have received a copy of the GNU General Public
Packit 709fb3
   License along with gnulib; if not, see
Packit 709fb3
   <http://www.gnu.org/licenses/>.  */
Packit 709fb3
Packit 709fb3
#ifndef _GETOPT_PFX_EXT_H
Packit 709fb3
#define _GETOPT_PFX_EXT_H 1
Packit 709fb3
Packit 709fb3
/* This header should not be used directly; include getopt.h instead.
Packit 709fb3
   It does not have a protective #error, because the guard macro for
Packit 709fb3
   getopt.h in gnulib is not fixed.  */
Packit 709fb3
Packit 709fb3
/* Standalone applications should #define __GETOPT_PREFIX to an
Packit 709fb3
   identifier that prefixes the external functions and variables
Packit 709fb3
   defined in getopt-core.h and getopt-ext.h.  Systematically
Packit 709fb3
   rename identifiers so that they do not collide with the system
Packit 709fb3
   functions and variables.  Renaming avoids problems with some
Packit 709fb3
   compilers and linkers.  */
Packit 709fb3
#ifdef __GETOPT_PREFIX
Packit 709fb3
# ifndef __GETOPT_ID
Packit 709fb3
#  define __GETOPT_CONCAT(x, y) x ## y
Packit 709fb3
#  define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)
Packit 709fb3
#  define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)
Packit 709fb3
# endif
Packit 709fb3
# undef getopt_long
Packit 709fb3
# undef getopt_long_only
Packit 709fb3
# undef option
Packit 709fb3
# undef _getopt_internal
Packit 709fb3
# define getopt_long __GETOPT_ID (getopt_long)
Packit 709fb3
# define getopt_long_only __GETOPT_ID (getopt_long_only)
Packit 709fb3
# define option __GETOPT_ID (option)
Packit 709fb3
# define _getopt_internal __GETOPT_ID (getopt_internal)
Packit 709fb3
Packit 709fb3
/* The system's getopt.h may have already included getopt-ext.h to
Packit 709fb3
   declare the unprefixed identifiers.  Undef _GETOPT_EXT_H so that
Packit 709fb3
   getopt-ext.h declares them with prefixes.  */
Packit 709fb3
# undef _GETOPT_EXT_H
Packit 709fb3
#endif
Packit 709fb3
Packit 709fb3
/* Standalone applications get correct prototypes for getopt_long and
Packit 709fb3
   getopt_long_only; they declare "char **argv".  For backward
Packit 709fb3
   compatibility with old applications, if __GETOPT_PREFIX is not
Packit 709fb3
   defined, we supply GNU-libc-compatible, but incorrect, prototypes
Packit 709fb3
   using "char *const *argv".  (GNU libc is stuck with the incorrect
Packit 709fb3
   prototypes, as they are baked into older versions of LSB.)  */
Packit 709fb3
#ifndef __getopt_argv_const
Packit 709fb3
# if defined __GETOPT_PREFIX
Packit 709fb3
#  define __getopt_argv_const /* empty */
Packit 709fb3
# else
Packit 709fb3
#  define __getopt_argv_const const
Packit 709fb3
# endif
Packit 709fb3
#endif
Packit 709fb3
Packit 709fb3
#include <getopt-ext.h>
Packit 709fb3
Packit 709fb3
#endif /* _GETOPT_PFX_EXT_H */