Updated to fedora-glibc-20050303T1335
[glibc.git] / timezone / private.h
blob5de2f7dfe46d9ac84f8a0a8fdcbadb7a2591e60b
1 #ifndef PRIVATE_H
3 #define PRIVATE_H
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 */
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!
19 ** ID
22 #ifndef lint
23 #ifndef NOID
24 static char privatehid[] = "@(#)private.h 7.55";
25 #endif /* !defined NOID */
26 #endif /* !defined lint */
29 ** Defaults for preprocessor symbols.
30 ** You can override these in your C compiler options, e.g. `-DHAVE_ADJTIME=0'.
33 #ifndef HAVE_ADJTIME
34 #define HAVE_ADJTIME 1
35 #endif /* !defined HAVE_ADJTIME */
37 #ifndef HAVE_GETTEXT
38 #define HAVE_GETTEXT 0
39 #endif /* !defined HAVE_GETTEXT */
41 #ifndef HAVE_INCOMPATIBLE_CTIME_R
42 #define HAVE_INCOMPATIBLE_CTIME_R 0
43 #endif /* !defined INCOMPATIBLE_CTIME_R */
45 #ifndef HAVE_SETTIMEOFDAY
46 #define HAVE_SETTIMEOFDAY 3
47 #endif /* !defined HAVE_SETTIMEOFDAY */
49 #ifndef HAVE_STRERROR
50 #define HAVE_STRERROR 1
51 #endif /* !defined HAVE_STRERROR */
53 #ifndef HAVE_SYMLINK
54 #define HAVE_SYMLINK 1
55 #endif /* !defined HAVE_SYMLINK */
57 #ifndef HAVE_SYS_STAT_H
58 #define HAVE_SYS_STAT_H 1
59 #endif /* !defined HAVE_SYS_STAT_H */
61 #ifndef HAVE_SYS_WAIT_H
62 #define HAVE_SYS_WAIT_H 1
63 #endif /* !defined HAVE_SYS_WAIT_H */
65 #ifndef HAVE_UNISTD_H
66 #define HAVE_UNISTD_H 1
67 #endif /* !defined HAVE_UNISTD_H */
69 #ifndef HAVE_UTMPX_H
70 #define HAVE_UTMPX_H 0
71 #endif /* !defined HAVE_UTMPX_H */
73 #ifndef LOCALE_HOME
74 #define LOCALE_HOME "/usr/lib/locale"
75 #endif /* !defined LOCALE_HOME */
77 #if HAVE_INCOMPATIBLE_CTIME_R
78 #define asctime_r _incompatible_asctime_r
79 #define ctime_r _incompatible_ctime_r
80 #endif /* HAVE_INCOMPATIBLE_CTIME_R */
83 ** Nested includes
86 #include "sys/types.h" /* for time_t */
87 #include "stdio.h"
88 #include "errno.h"
89 #include "string.h"
90 #include "limits.h" /* for CHAR_BIT */
91 #include "time.h"
92 #include "stdlib.h"
94 #if HAVE_GETTEXT - 0
95 #include "libintl.h"
96 #endif /* HAVE_GETTEXT - 0 */
98 #if HAVE_SYS_WAIT_H - 0
99 #include <sys/wait.h> /* for WIFEXITED and WEXITSTATUS */
100 #endif /* HAVE_SYS_WAIT_H - 0 */
102 #ifndef WIFEXITED
103 #define WIFEXITED(status) (((status) & 0xff) == 0)
104 #endif /* !defined WIFEXITED */
105 #ifndef WEXITSTATUS
106 #define WEXITSTATUS(status) (((status) >> 8) & 0xff)
107 #endif /* !defined WEXITSTATUS */
109 #if HAVE_UNISTD_H - 0
110 #include "unistd.h" /* for F_OK and R_OK */
111 #endif /* HAVE_UNISTD_H - 0 */
113 #if !(HAVE_UNISTD_H - 0)
114 #ifndef F_OK
115 #define F_OK 0
116 #endif /* !defined F_OK */
117 #ifndef R_OK
118 #define R_OK 4
119 #endif /* !defined R_OK */
120 #endif /* !(HAVE_UNISTD_H - 0) */
122 /* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */
123 #define is_digit(c) ((unsigned)(c) - '0' <= 9)
126 ** Workarounds for compilers/systems.
130 ** SunOS 4.1.1 cc lacks prototypes.
133 #ifndef P
134 #ifdef __STDC__
135 #define P(x) x
136 #endif /* defined __STDC__ */
137 #ifndef __STDC__
138 #define P(x) ()
139 #endif /* !defined __STDC__ */
140 #endif /* !defined P */
143 ** SunOS 4.1.1 headers lack EXIT_SUCCESS.
146 #ifndef EXIT_SUCCESS
147 #define EXIT_SUCCESS 0
148 #endif /* !defined EXIT_SUCCESS */
151 ** SunOS 4.1.1 headers lack EXIT_FAILURE.
154 #ifndef EXIT_FAILURE
155 #define EXIT_FAILURE 1
156 #endif /* !defined EXIT_FAILURE */
159 ** SunOS 4.1.1 headers lack FILENAME_MAX.
162 #ifndef FILENAME_MAX
164 #ifndef MAXPATHLEN
165 #ifdef unix
166 #include "sys/param.h"
167 #endif /* defined unix */
168 #endif /* !defined MAXPATHLEN */
170 #ifdef MAXPATHLEN
171 #define FILENAME_MAX MAXPATHLEN
172 #endif /* defined MAXPATHLEN */
173 #ifndef MAXPATHLEN
174 #define FILENAME_MAX 1024 /* Pure guesswork */
175 #endif /* !defined MAXPATHLEN */
177 #endif /* !defined FILENAME_MAX */
180 ** SunOS 4.1.1 libraries lack remove.
183 #ifndef remove
184 extern int unlink P((const char * filename));
185 #define remove unlink
186 #endif /* !defined remove */
189 ** Some ancient errno.h implementations don't declare errno.
190 ** But some newer errno.h implementations define it as a macro.
191 ** Fix the former without affecting the latter.
194 #ifndef errno
195 extern int errno;
196 #endif /* !defined errno */
199 ** Some time.h implementations don't declare asctime_r.
200 ** Others might define it as a macro.
201 ** Fix the former without affecting the latter.
204 #ifndef asctime_r
205 extern char * asctime_r();
206 #endif
209 ** Private function declarations.
212 char * icalloc P((int nelem, int elsize));
213 char * icatalloc P((char * old, const char * new));
214 char * icpyalloc P((const char * string));
215 char * imalloc P((int n));
216 void * irealloc P((void * pointer, int size));
217 void icfree P((char * pointer));
218 void ifree P((char * pointer));
219 char * scheck P((const char *string, const char *format));
222 ** Finally, some convenience items.
225 #ifndef TRUE
226 #define TRUE 1
227 #endif /* !defined TRUE */
229 #ifndef FALSE
230 #define FALSE 0
231 #endif /* !defined FALSE */
233 #ifndef TYPE_BIT
234 #define TYPE_BIT(type) (sizeof (type) * CHAR_BIT)
235 #endif /* !defined TYPE_BIT */
237 #ifndef TYPE_SIGNED
238 #define TYPE_SIGNED(type) (((type) -1) < 0)
239 #endif /* !defined TYPE_SIGNED */
242 ** Since the definition of TYPE_INTEGRAL contains floating point numbers,
243 ** it cannot be used in preprocessor directives.
246 #ifndef TYPE_INTEGRAL
247 #define TYPE_INTEGRAL(type) (((type) 0.5) != 0.5)
248 #endif /* !defined TYPE_INTEGRAL */
250 #ifndef INT_STRLEN_MAXIMUM
252 ** 302 / 1000 is log10(2.0) rounded up.
253 ** Subtract one for the sign bit if the type is signed;
254 ** add one for integer division truncation;
255 ** add one more for a minus sign if the type is signed.
257 #define INT_STRLEN_MAXIMUM(type) \
258 ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + 1 + TYPE_SIGNED(type))
259 #endif /* !defined INT_STRLEN_MAXIMUM */
262 ** INITIALIZE(x)
265 #ifndef GNUC_or_lint
266 #ifdef lint
267 #define GNUC_or_lint
268 #endif /* defined lint */
269 #ifndef lint
270 #ifdef __GNUC__
271 #define GNUC_or_lint
272 #endif /* defined __GNUC__ */
273 #endif /* !defined lint */
274 #endif /* !defined GNUC_or_lint */
276 #ifndef INITIALIZE
277 #ifdef GNUC_or_lint
278 #define INITIALIZE(x) ((x) = 0)
279 #endif /* defined GNUC_or_lint */
280 #ifndef GNUC_or_lint
281 #define INITIALIZE(x)
282 #endif /* !defined GNUC_or_lint */
283 #endif /* !defined INITIALIZE */
286 ** For the benefit of GNU folk...
287 ** `_(MSGID)' uses the current locale's message library string for MSGID.
288 ** The default is to use gettext if available, and use MSGID otherwise.
291 #ifndef _
292 #if HAVE_GETTEXT - 0
293 #define _(msgid) gettext(msgid)
294 #else /* !(HAVE_GETTEXT - 0) */
295 #define _(msgid) msgid
296 #endif /* !(HAVE_GETTEXT - 0) */
297 #endif /* !defined _ */
299 #ifndef TZ_DOMAIN
300 #define TZ_DOMAIN "tz"
301 #endif /* !defined TZ_DOMAIN */
303 #if HAVE_INCOMPATIBLE_CTIME_R
304 #undef asctime_r
305 #undef ctime_r
306 char *asctime_r P((struct tm const *, char *));
307 char *ctime_r P((time_t const *, char *));
308 #endif /* HAVE_INCOMPATIBLE_CTIME_R */
311 ** UNIX was a registered trademark of The Open Group in 2003.
314 #endif /* !defined PRIVATE_H */