xref: /dflybsd-src/contrib/grep/lib/getopt-pfx-core.h (revision 91b9ed38d3db6a8a8ac5b66da1d43e6e331e259a)
1*09d4459fSDaniel Fojt /* getopt (basic, portable features) gnulib wrapper header.
2*09d4459fSDaniel Fojt    Copyright (C) 1989-2020 Free Software Foundation, Inc.
3*09d4459fSDaniel Fojt    This file is part of gnulib.
4*09d4459fSDaniel Fojt    Unlike most of the getopt implementation, it is NOT shared
5*09d4459fSDaniel Fojt    with the GNU C Library.
6*09d4459fSDaniel Fojt 
7*09d4459fSDaniel Fojt    This file is free software; you can redistribute it and/or modify it
8*09d4459fSDaniel Fojt    under the terms of the GNU General Public License as
9*09d4459fSDaniel Fojt    published by the Free Software Foundation; either version 3 of
10*09d4459fSDaniel Fojt    the License, or (at your option) any later version.
11*09d4459fSDaniel Fojt 
12*09d4459fSDaniel Fojt    This file is distributed in the hope that it will be useful, but
13*09d4459fSDaniel Fojt    WITHOUT ANY WARRANTY; without even the implied warranty of
14*09d4459fSDaniel Fojt    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15*09d4459fSDaniel Fojt    General Public License for more details.
16*09d4459fSDaniel Fojt 
17*09d4459fSDaniel Fojt    You should have received a copy of the GNU General Public
18*09d4459fSDaniel Fojt    License along with gnulib; if not, see
19*09d4459fSDaniel Fojt    <https://www.gnu.org/licenses/>.  */
20*09d4459fSDaniel Fojt 
21*09d4459fSDaniel Fojt #ifndef _GETOPT_PFX_CORE_H
22*09d4459fSDaniel Fojt #define _GETOPT_PFX_CORE_H 1
23*09d4459fSDaniel Fojt 
24*09d4459fSDaniel Fojt /* This header should not be used directly; include getopt.h or
25*09d4459fSDaniel Fojt    unistd.h instead.  It does not have a protective #error, because
26*09d4459fSDaniel Fojt    the guard macro for getopt.h in gnulib is not fixed.  */
27*09d4459fSDaniel Fojt 
28*09d4459fSDaniel Fojt /* Standalone applications should #define __GETOPT_PREFIX to an
29*09d4459fSDaniel Fojt    identifier that prefixes the external functions and variables
30*09d4459fSDaniel Fojt    defined in getopt-core.h and getopt-ext.h.  Systematically
31*09d4459fSDaniel Fojt    rename identifiers so that they do not collide with the system
32*09d4459fSDaniel Fojt    functions and variables.  Renaming avoids problems with some
33*09d4459fSDaniel Fojt    compilers and linkers.  */
34*09d4459fSDaniel Fojt #ifdef __GETOPT_PREFIX
35*09d4459fSDaniel Fojt # ifndef __GETOPT_ID
36*09d4459fSDaniel Fojt #  define __GETOPT_CONCAT(x, y) x ## y
37*09d4459fSDaniel Fojt #  define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)
38*09d4459fSDaniel Fojt #  define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)
39*09d4459fSDaniel Fojt # endif
40*09d4459fSDaniel Fojt # undef getopt
41*09d4459fSDaniel Fojt # undef optarg
42*09d4459fSDaniel Fojt # undef opterr
43*09d4459fSDaniel Fojt # undef optind
44*09d4459fSDaniel Fojt # undef optopt
45*09d4459fSDaniel Fojt # define getopt __GETOPT_ID (getopt)
46*09d4459fSDaniel Fojt # define optarg __GETOPT_ID (optarg)
47*09d4459fSDaniel Fojt # define opterr __GETOPT_ID (opterr)
48*09d4459fSDaniel Fojt # define optind __GETOPT_ID (optind)
49*09d4459fSDaniel Fojt # define optopt __GETOPT_ID (optopt)
50*09d4459fSDaniel Fojt 
51*09d4459fSDaniel Fojt /* The system's getopt.h may have already included getopt-core.h to
52*09d4459fSDaniel Fojt    declare the unprefixed identifiers.  Undef _GETOPT_CORE_H so that
53*09d4459fSDaniel Fojt    getopt-core.h declares them with prefixes.  */
54*09d4459fSDaniel Fojt # undef _GETOPT_CORE_H
55*09d4459fSDaniel Fojt #endif
56*09d4459fSDaniel Fojt 
57*09d4459fSDaniel Fojt #include <getopt-core.h>
58*09d4459fSDaniel Fojt 
59*09d4459fSDaniel Fojt #endif /* _GETOPT_PFX_CORE_H */
60