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