* malloc/memusagestat.c (main): Use return instead of exit to
[platform/upstream/glibc.git] / timezone / private.h
1 #ifndef PRIVATE_H
2
3 #define PRIVATE_H
4
5 /*
6 ** This file is in the public domain, so clarified as of
7 ** 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
8 */
9
10 /*
11 ** This header is for use ONLY with the time conversion code.
12 ** There is no guarantee that it will remain unchanged,
13 ** or that it will remain at all.
14 ** Do NOT copy it to any system include directory.
15 ** Thank you!
16 */
17
18 /*
19 ** ID
20 */
21
22 #ifndef lint
23 #ifndef NOID
24 static char     privatehid[] = "@(#)private.h   7.51";
25 #endif /* !defined NOID */
26 #endif /* !defined lint */
27
28 /*
29 ** Defaults for preprocessor symbols.
30 ** You can override these in your C compiler options, e.g. `-DHAVE_ADJTIME=0'.
31 */
32
33 #ifndef HAVE_ADJTIME
34 #define HAVE_ADJTIME            1
35 #endif /* !defined HAVE_ADJTIME */
36
37 #ifndef HAVE_GETTEXT
38 #define HAVE_GETTEXT            0
39 #endif /* !defined HAVE_GETTEXT */
40
41 #ifndef HAVE_INCOMPATIBLE_CTIME_R
42 #define HAVE_INCOMPATIBLE_CTIME_R       0
43 #endif /* !defined INCOMPATIBLE_CTIME_R */
44
45 #ifndef HAVE_SETTIMEOFDAY
46 #define HAVE_SETTIMEOFDAY       3
47 #endif /* !defined HAVE_SETTIMEOFDAY */
48
49 #ifndef HAVE_STRERROR
50 #define HAVE_STRERROR           1
51 #endif /* !defined HAVE_STRERROR */
52
53 #ifndef HAVE_SYMLINK
54 #define HAVE_SYMLINK            1
55 #endif /* !defined HAVE_SYMLINK */
56
57 #ifndef HAVE_SYS_WAIT_H
58 #define HAVE_SYS_WAIT_H         1
59 #endif /* !defined HAVE_SYS_WAIT_H */
60
61 #ifndef HAVE_UNISTD_H
62 #define HAVE_UNISTD_H           1
63 #endif /* !defined HAVE_UNISTD_H */
64
65 #ifndef HAVE_UTMPX_H
66 #define HAVE_UTMPX_H            0
67 #endif /* !defined HAVE_UTMPX_H */
68
69 #ifndef LOCALE_HOME
70 #define LOCALE_HOME             "/usr/lib/locale"
71 #endif /* !defined LOCALE_HOME */
72
73 #if HAVE_INCOMPATIBLE_CTIME_R
74 #define asctime_r _incompatible_asctime_r
75 #define ctime_r _incompatible_ctime_r
76 #endif /* HAVE_INCOMPATIBLE_CTIME_R */
77
78 /*
79 ** Nested includes
80 */
81
82 #include "sys/types.h"  /* for time_t */
83 #include "stdio.h"
84 #include "errno.h"
85 #include "string.h"
86 #include "limits.h"     /* for CHAR_BIT */
87 #include "time.h"
88 #include "stdlib.h"
89
90 #if HAVE_GETTEXT - 0
91 #include "libintl.h"
92 #endif /* HAVE_GETTEXT - 0 */
93
94 #if HAVE_SYS_WAIT_H - 0
95 #include <sys/wait.h>   /* for WIFEXITED and WEXITSTATUS */
96 #endif /* HAVE_SYS_WAIT_H - 0 */
97
98 #ifndef WIFEXITED
99 #define WIFEXITED(status)       (((status) & 0xff) == 0)
100 #endif /* !defined WIFEXITED */
101 #ifndef WEXITSTATUS
102 #define WEXITSTATUS(status)     (((status) >> 8) & 0xff)
103 #endif /* !defined WEXITSTATUS */
104
105 #if HAVE_UNISTD_H - 0
106 #include "unistd.h"     /* for F_OK and R_OK */
107 #endif /* HAVE_UNISTD_H - 0 */
108
109 #if !(HAVE_UNISTD_H - 0)
110 #ifndef F_OK
111 #define F_OK    0
112 #endif /* !defined F_OK */
113 #ifndef R_OK
114 #define R_OK    4
115 #endif /* !defined R_OK */
116 #endif /* !(HAVE_UNISTD_H - 0) */
117
118 /* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX.  */
119 #define is_digit(c) ((unsigned)(c) - '0' <= 9)
120
121 /*
122 ** Workarounds for compilers/systems.
123 */
124
125 /*
126 ** SunOS 4.1.1 cc lacks const.
127 */
128
129 #ifndef const
130 #ifndef __STDC__
131 #define const
132 #endif /* !defined __STDC__ */
133 #endif /* !defined const */
134
135 /*
136 ** SunOS 4.1.1 cc lacks prototypes.
137 */
138
139 #ifndef P
140 #ifdef __STDC__
141 #define P(x)    x
142 #endif /* defined __STDC__ */
143 #ifndef __STDC__
144 #define P(x)    ()
145 #endif /* !defined __STDC__ */
146 #endif /* !defined P */
147
148 /*
149 ** SunOS 4.1.1 headers lack EXIT_SUCCESS.
150 */
151
152 #ifndef EXIT_SUCCESS
153 #define EXIT_SUCCESS    0
154 #endif /* !defined EXIT_SUCCESS */
155
156 /*
157 ** SunOS 4.1.1 headers lack EXIT_FAILURE.
158 */
159
160 #ifndef EXIT_FAILURE
161 #define EXIT_FAILURE    1
162 #endif /* !defined EXIT_FAILURE */
163
164 /*
165 ** SunOS 4.1.1 headers lack FILENAME_MAX.
166 */
167
168 #ifndef FILENAME_MAX
169
170 #ifndef MAXPATHLEN
171 #ifdef unix
172 #include "sys/param.h"
173 #endif /* defined unix */
174 #endif /* !defined MAXPATHLEN */
175
176 #ifdef MAXPATHLEN
177 #define FILENAME_MAX    MAXPATHLEN
178 #endif /* defined MAXPATHLEN */
179 #ifndef MAXPATHLEN
180 #define FILENAME_MAX    1024            /* Pure guesswork */
181 #endif /* !defined MAXPATHLEN */
182
183 #endif /* !defined FILENAME_MAX */
184
185 /*
186 ** SunOS 4.1.1 libraries lack remove.
187 */
188
189 #ifndef remove
190 extern int      unlink P((const char * filename));
191 #define remove  unlink
192 #endif /* !defined remove */
193
194 /*
195 ** Some ancient errno.h implementations don't declare errno.
196 ** But some newer errno.h implementations define it as a macro.
197 ** Fix the former without affecting the latter.
198 */
199 #ifndef errno
200 extern int errno;
201 #endif /* !defined errno */
202
203 /*
204 ** Private function declarations.
205 */
206 char *  icalloc P((int nelem, int elsize));
207 char *  icatalloc P((char * old, const char * new));
208 char *  icpyalloc P((const char * string));
209 char *  imalloc P((int n));
210 void *  irealloc P((void * pointer, int size));
211 void    icfree P((char * pointer));
212 void    ifree P((char * pointer));
213 char *  scheck P((const char *string, const char *format));
214
215
216 /*
217 ** Finally, some convenience items.
218 */
219
220 #ifndef TRUE
221 #define TRUE    1
222 #endif /* !defined TRUE */
223
224 #ifndef FALSE
225 #define FALSE   0
226 #endif /* !defined FALSE */
227
228 #ifndef TYPE_BIT
229 #define TYPE_BIT(type)  (sizeof (type) * CHAR_BIT)
230 #endif /* !defined TYPE_BIT */
231
232 #ifndef TYPE_SIGNED
233 #define TYPE_SIGNED(type) (((type) -1) < 0)
234 #endif /* !defined TYPE_SIGNED */
235
236 #ifndef INT_STRLEN_MAXIMUM
237 /*
238 ** 302 / 1000 is log10(2.0) rounded up.
239 ** Subtract one for the sign bit if the type is signed;
240 ** add one for integer division truncation;
241 ** add one more for a minus sign if the type is signed.
242 */
243 #define INT_STRLEN_MAXIMUM(type) \
244     ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + 1 + TYPE_SIGNED(type))
245 #endif /* !defined INT_STRLEN_MAXIMUM */
246
247 /*
248 ** INITIALIZE(x)
249 */
250
251 #ifndef GNUC_or_lint
252 #ifdef lint
253 #define GNUC_or_lint
254 #endif /* defined lint */
255 #ifndef lint
256 #ifdef __GNUC__
257 #define GNUC_or_lint
258 #endif /* defined __GNUC__ */
259 #endif /* !defined lint */
260 #endif /* !defined GNUC_or_lint */
261
262 #ifndef INITIALIZE
263 #ifdef GNUC_or_lint
264 #define INITIALIZE(x)   ((x) = 0)
265 #endif /* defined GNUC_or_lint */
266 #ifndef GNUC_or_lint
267 #define INITIALIZE(x)
268 #endif /* !defined GNUC_or_lint */
269 #endif /* !defined INITIALIZE */
270
271 /*
272 ** For the benefit of GNU folk...
273 ** `_(MSGID)' uses the current locale's message library string for MSGID.
274 ** The default is to use gettext if available, and use MSGID otherwise.
275 */
276
277 #ifndef _
278 #if HAVE_GETTEXT - 0
279 #define _(msgid) gettext(msgid)
280 #else /* !(HAVE_GETTEXT - 0) */
281 #define _(msgid) msgid
282 #endif /* !(HAVE_GETTEXT - 0) */
283 #endif /* !defined _ */
284
285 #ifndef TZ_DOMAIN
286 #define TZ_DOMAIN "tz"
287 #endif /* !defined TZ_DOMAIN */
288
289 #if HAVE_INCOMPATIBLE_CTIME_R
290 #undef asctime_r
291 #undef ctime_r
292 char *asctime_r P((struct tm const *, char *));
293 char *ctime_r P((time_t const *, char *));
294 #endif /* HAVE_INCOMPATIBLE_CTIME_R */
295
296 /*
297 ** UNIX was a registered trademark of UNIX System Laboratories in 1993.
298 */
299
300 #endif /* !defined PRIVATE_H */