1/* Declarations for getopt (POSIX compatibility shim).
2 Copyright (C) 1989-2024 Free Software Foundation, Inc.
3 Unlike the bulk of the getopt implementation, this file is NOT part
4 of gnulib.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <https://www.gnu.org/licenses/>. */
19
20#ifndef _GETOPT_POSIX_H
21#define _GETOPT_POSIX_H 1
22
23#if !defined _UNISTD_H && !defined _STDIO_H
24#error "Never include getopt_posix.h directly; use unistd.h instead."
25#endif
26
27#include <bits/getopt_core.h>
28
29__BEGIN_DECLS
30
31#if defined __USE_POSIX2 && !defined __USE_POSIX_IMPLICITLY \
32 && !defined __USE_GNU && !defined _GETOPT_H
33/* GNU getopt has more functionality than POSIX getopt. When we are
34 explicitly conforming to POSIX and not GNU, and getopt.h (which is
35 not part of POSIX) has not been included, the extra functionality
36 is disabled. */
37# ifdef __REDIRECT
38extern int __REDIRECT_NTH (getopt, (int ___argc, char *const *___argv,
39 const char *__shortopts),
40 __posix_getopt);
41# else
42extern int __posix_getopt (int ___argc, char *const *___argv,
43 const char *__shortopts)
44 __THROW __nonnull ((2, 3));
45# define getopt __posix_getopt
46# endif
47#endif
48
49__END_DECLS
50
51#endif /* getopt_posix.h */
52