vendor/grep: upgrade from 2.22 to 3.4
[dragonfly.git] / contrib / grep / lib / getopt-pfx-ext.h
1 /* getopt (GNU extensions) gnulib wrapper header.
2    Copyright (C) 1989-2020 Free Software Foundation, Inc.
3    This file is part of gnulib.
4    Unlike most of the getopt implementation, it is NOT shared
5    with the GNU C Library.
6
7    This file is free software; you can redistribute it and/or modify it
8    under the terms of the GNU General Public License as
9    published by the Free Software Foundation; either version 3 of
10    the License, or (at your option) any later version.
11
12    This file is distributed in the hope that it will be useful, but
13    WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    General Public License for more details.
16
17    You should have received a copy of the GNU General Public
18    License along with gnulib; if not, see
19    <https://www.gnu.org/licenses/>.  */
20
21 #ifndef _GETOPT_PFX_EXT_H
22 #define _GETOPT_PFX_EXT_H 1
23
24 /* This header should not be used directly; include getopt.h instead.
25    It does not have a protective #error, because the guard macro for
26    getopt.h in gnulib is not fixed.  */
27
28 /* Standalone applications should #define __GETOPT_PREFIX to an
29    identifier that prefixes the external functions and variables
30    defined in getopt-core.h and getopt-ext.h.  Systematically
31    rename identifiers so that they do not collide with the system
32    functions and variables.  Renaming avoids problems with some
33    compilers and linkers.  */
34 #ifdef __GETOPT_PREFIX
35 # ifndef __GETOPT_ID
36 #  define __GETOPT_CONCAT(x, y) x ## y
37 #  define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)
38 #  define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)
39 # endif
40 # undef getopt_long
41 # undef getopt_long_only
42 # undef option
43 # undef _getopt_internal
44 # define getopt_long __GETOPT_ID (getopt_long)
45 # define getopt_long_only __GETOPT_ID (getopt_long_only)
46 # define option __GETOPT_ID (option)
47 # define _getopt_internal __GETOPT_ID (getopt_internal)
48
49 /* The system's getopt.h may have already included getopt-ext.h to
50    declare the unprefixed identifiers.  Undef _GETOPT_EXT_H so that
51    getopt-ext.h declares them with prefixes.  */
52 # undef _GETOPT_EXT_H
53 #endif
54
55 /* Standalone applications get correct prototypes for getopt_long and
56    getopt_long_only; they declare "char **argv".  For backward
57    compatibility with old applications, if __GETOPT_PREFIX is not
58    defined, we supply GNU-libc-compatible, but incorrect, prototypes
59    using "char *const *argv".  (GNU libc is stuck with the incorrect
60    prototypes, as they are baked into older versions of LSB.)  */
61 #ifndef __getopt_argv_const
62 # if defined __GETOPT_PREFIX
63 #  define __getopt_argv_const /* empty */
64 # else
65 #  define __getopt_argv_const const
66 # endif
67 #endif
68
69 #include <getopt-ext.h>
70
71 #endif /* _GETOPT_PFX_EXT_H */