1 /* getopt (basic, portable features) gnulib wrapper header.
2 Copyright (C) 1989-2018 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.
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.
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.
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/>. */
21 #ifndef _GETOPT_PFX_CORE_H
22 #define _GETOPT_PFX_CORE_H 1
24 /* This header should not be used directly; include getopt.h or
25 unistd.h instead. It does not have a protective #error, because
26 the guard macro for getopt.h in gnulib is not fixed. */
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
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)
45 # define getopt __GETOPT_ID (getopt)
46 # define optarg __GETOPT_ID (optarg)
47 # define opterr __GETOPT_ID (opterr)
48 # define optind __GETOPT_ID (optind)
49 # define optopt __GETOPT_ID (optopt)
51 /* The system's getopt.h may have already included getopt-core.h to
52 declare the unprefixed identifiers. Undef _GETOPT_CORE_H so that
53 getopt-core.h declares them with prefixes. */
54 # undef _GETOPT_CORE_H
57 #include <getopt-core.h>
59 #endif /* _GETOPT_PFX_CORE_H */