1 /* Name frobnication for compiling argp outside of glibc
2 Copyright (C) 1997-2018 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Written by Miles Bader <miles@gnu.ai.mit.edu>.
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.
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.
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 <http://www.gnu.org/licenses/>. */
21 /* This code is written for inclusion in gnu-libc, and uses names in the
22 namespace reserved for libc. If we're not compiling in libc, define those
23 names to be the normal ones instead. */
25 /* argp-parse functions */
27 #define __argp_parse argp_parse
28 #undef __option_is_end
29 #define __option_is_end _option_is_end
30 #undef __option_is_short
31 #define __option_is_short _option_is_short
33 #define __argp_input _argp_input
35 /* argp-help functions */
37 #define __argp_help argp_help
39 #define __argp_error argp_error
41 #define __argp_failure argp_failure
42 #undef __argp_state_help
43 #define __argp_state_help argp_state_help
45 #define __argp_usage argp_usage
47 /* argp-fmtstream functions */
48 #undef __argp_make_fmtstream
49 #define __argp_make_fmtstream argp_make_fmtstream
50 #undef __argp_fmtstream_free
51 #define __argp_fmtstream_free argp_fmtstream_free
52 #undef __argp_fmtstream_putc
53 #define __argp_fmtstream_putc argp_fmtstream_putc
54 #undef __argp_fmtstream_puts
55 #define __argp_fmtstream_puts argp_fmtstream_puts
56 #undef __argp_fmtstream_write
57 #define __argp_fmtstream_write argp_fmtstream_write
58 #undef __argp_fmtstream_printf
59 #define __argp_fmtstream_printf argp_fmtstream_printf
60 #undef __argp_fmtstream_set_lmargin
61 #define __argp_fmtstream_set_lmargin argp_fmtstream_set_lmargin
62 #undef __argp_fmtstream_set_rmargin
63 #define __argp_fmtstream_set_rmargin argp_fmtstream_set_rmargin
64 #undef __argp_fmtstream_set_wmargin
65 #define __argp_fmtstream_set_wmargin argp_fmtstream_set_wmargin
66 #undef __argp_fmtstream_point
67 #define __argp_fmtstream_point argp_fmtstream_point
68 #undef __argp_fmtstream_update
69 #define __argp_fmtstream_update _argp_fmtstream_update
70 #undef __argp_fmtstream_ensure
71 #define __argp_fmtstream_ensure _argp_fmtstream_ensure
72 #undef __argp_fmtstream_lmargin
73 #define __argp_fmtstream_lmargin argp_fmtstream_lmargin
74 #undef __argp_fmtstream_rmargin
75 #define __argp_fmtstream_rmargin argp_fmtstream_rmargin
76 #undef __argp_fmtstream_wmargin
77 #define __argp_fmtstream_wmargin argp_fmtstream_wmargin
81 #include "strchrnul.h"
84 /* normal libc functions we call */
86 #define __flockfile flockfile
88 #define __funlockfile funlockfile
90 #define __mempcpy mempcpy
94 #define __strcasecmp strcasecmp
96 #define __strchrnul strchrnul
98 #define __strerror_r strerror_r
100 #define __strndup strndup
102 #define __vsnprintf vsnprintf
104 #if defined(HAVE_DECL_CLEARERR_UNLOCKED) && !HAVE_DECL_CLEARERR_UNLOCKED
105 # define clearerr_unlocked(x) clearerr (x)
107 #if defined(HAVE_DECL_FEOF_UNLOCKED) && !HAVE_DECL_FEOF_UNLOCKED
108 # define feof_unlocked(x) feof (x)
110 #if defined(HAVE_DECL_FERROR_UNLOCKED) && !HAVE_DECL_FERROR_UNLOCKED
111 # define ferror_unlocked(x) ferror (x)
113 #if defined(HAVE_DECL_FFLUSH_UNLOCKED) && !HAVE_DECL_FFLUSH_UNLOCKED
114 # define fflush_unlocked(x) fflush (x)
116 #if defined(HAVE_DECL_FGETS_UNLOCKED) && !HAVE_DECL_FGETS_UNLOCKED
117 # define fgets_unlocked(x,y,z) fgets (x,y,z)
119 #if defined(HAVE_DECL_FPUTC_UNLOCKED) && !HAVE_DECL_FPUTC_UNLOCKED
120 # define fputc_unlocked(x,y) fputc (x,y)
122 #if defined(HAVE_DECL_FPUTS_UNLOCKED) && !HAVE_DECL_FPUTS_UNLOCKED
123 # define fputs_unlocked(x,y) fputs (x,y)
125 #if defined(HAVE_DECL_FREAD_UNLOCKED) && !HAVE_DECL_FREAD_UNLOCKED
126 # define fread_unlocked(w,x,y,z) fread (w,x,y,z)
128 #if defined(HAVE_DECL_FWRITE_UNLOCKED) && !HAVE_DECL_FWRITE_UNLOCKED
129 # define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z)
131 #if defined(HAVE_DECL_GETC_UNLOCKED) && !HAVE_DECL_GETC_UNLOCKED
132 # define getc_unlocked(x) getc (x)
134 #if defined(HAVE_DECL_GETCHAR_UNLOCKED) && !HAVE_DECL_GETCHAR_UNLOCKED
135 # define getchar_unlocked() getchar ()
137 #if defined(HAVE_DECL_PUTC_UNLOCKED) && !HAVE_DECL_PUTC_UNLOCKED
138 # define putc_unlocked(x,y) putc (x,y)
140 #if defined(HAVE_DECL_PUTCHAR_UNLOCKED) && !HAVE_DECL_PUTCHAR_UNLOCKED
141 # define putchar_unlocked(x) putchar (x)
144 extern char *__argp_basename (char *name
);
149 #define __set_errno(e) (errno = (e))
152 #if defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
153 # define __argp_short_program_name() (program_invocation_short_name)
155 extern char *__argp_short_program_name (void);