]> git.ipfire.org Git - thirdparty/glibc.git/blame - timezone/private.h
* timezone/private.h: Update from tzcode2006a.
[thirdparty/glibc.git] / timezone / private.h
CommitLineData
28f540f4
RM
1#ifndef PRIVATE_H
2
3#define PRIVATE_H
4
dfe1754a
RM
5/*
6** This file is in the public domain, so clarified as of
53751fd5 7** 1996-06-05 by Arthur David Olson.
dfe1754a
RM
8*/
9
28f540f4
RM
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
792dcd77 24static char privatehid[] = "@(#)private.h 7.55";
28f540f4
RM
25#endif /* !defined NOID */
26#endif /* !defined lint */
27
c872f5cc
UD
28#define GRANDPARENTED "Local time zone must be set--see zic manual page"
29
28f540f4 30/*
6c2f0507
RM
31** Defaults for preprocessor symbols.
32** You can override these in your C compiler options, e.g. `-DHAVE_ADJTIME=0'.
28f540f4
RM
33*/
34
6c2f0507
RM
35#ifndef HAVE_ADJTIME
36#define HAVE_ADJTIME 1
37#endif /* !defined HAVE_ADJTIME */
38
92777700
RM
39#ifndef HAVE_GETTEXT
40#define HAVE_GETTEXT 0
41#endif /* !defined HAVE_GETTEXT */
42
eb0ad543
UD
43#ifndef HAVE_INCOMPATIBLE_CTIME_R
44#define HAVE_INCOMPATIBLE_CTIME_R 0
45#endif /* !defined INCOMPATIBLE_CTIME_R */
46
6c2f0507
RM
47#ifndef HAVE_SETTIMEOFDAY
48#define HAVE_SETTIMEOFDAY 3
49#endif /* !defined HAVE_SETTIMEOFDAY */
50
92777700 51#ifndef HAVE_STRERROR
eb0ad543 52#define HAVE_STRERROR 1
92777700
RM
53#endif /* !defined HAVE_STRERROR */
54
ae828bc6
UD
55#ifndef HAVE_SYMLINK
56#define HAVE_SYMLINK 1
57#endif /* !defined HAVE_SYMLINK */
58
289ac9dd
UD
59#ifndef HAVE_SYS_STAT_H
60#define HAVE_SYS_STAT_H 1
61#endif /* !defined HAVE_SYS_STAT_H */
62
38c097ca
UD
63#ifndef HAVE_SYS_WAIT_H
64#define HAVE_SYS_WAIT_H 1
65#endif /* !defined HAVE_SYS_WAIT_H */
66
6c2f0507
RM
67#ifndef HAVE_UNISTD_H
68#define HAVE_UNISTD_H 1
69#endif /* !defined HAVE_UNISTD_H */
70
f2e235b9
RM
71#ifndef HAVE_UTMPX_H
72#define HAVE_UTMPX_H 0
73#endif /* !defined HAVE_UTMPX_H */
74
6c2f0507
RM
75#ifndef LOCALE_HOME
76#define LOCALE_HOME "/usr/lib/locale"
77#endif /* !defined LOCALE_HOME */
28f540f4 78
eb0ad543
UD
79#if HAVE_INCOMPATIBLE_CTIME_R
80#define asctime_r _incompatible_asctime_r
81#define ctime_r _incompatible_ctime_r
82#endif /* HAVE_INCOMPATIBLE_CTIME_R */
83
28f540f4 84/*
6c2f0507 85** Nested includes
28f540f4
RM
86*/
87
6c2f0507
RM
88#include "sys/types.h" /* for time_t */
89#include "stdio.h"
6c2f0507
RM
90#include "errno.h"
91#include "string.h"
a334319f 92#include "limits.h" /* for CHAR_BIT */
6c2f0507
RM
93#include "time.h"
94#include "stdlib.h"
95
c872f5cc 96#if HAVE_GETTEXT
92777700 97#include "libintl.h"
c872f5cc 98#endif /* HAVE_GETTEXT */
92777700 99
c872f5cc 100#if HAVE_SYS_WAIT_H
38c097ca 101#include <sys/wait.h> /* for WIFEXITED and WEXITSTATUS */
c872f5cc 102#endif /* HAVE_SYS_WAIT_H */
38c097ca
UD
103
104#ifndef WIFEXITED
105#define WIFEXITED(status) (((status) & 0xff) == 0)
106#endif /* !defined WIFEXITED */
107#ifndef WEXITSTATUS
108#define WEXITSTATUS(status) (((status) >> 8) & 0xff)
109#endif /* !defined WEXITSTATUS */
110
c872f5cc 111#if HAVE_UNISTD_H
6c2f0507 112#include "unistd.h" /* for F_OK and R_OK */
c872f5cc 113#endif /* HAVE_UNISTD_H */
6c2f0507 114
c872f5cc 115#if !HAVE_UNISTD_H
6c2f0507
RM
116#ifndef F_OK
117#define F_OK 0
118#endif /* !defined F_OK */
119#ifndef R_OK
120#define R_OK 4
121#endif /* !defined R_OK */
c872f5cc 122#endif /* !HAVE_UNISTD_H */
28f540f4 123
c872f5cc 124/* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */
f2e235b9
RM
125#define is_digit(c) ((unsigned)(c) - '0' <= 9)
126
28f540f4 127/*
6c2f0507 128** Workarounds for compilers/systems.
28f540f4
RM
129*/
130
28f540f4 131/*
a334319f 132** SunOS 4.1.1 cc lacks prototypes.
28f540f4
RM
133*/
134
135#ifndef P
a334319f 136#ifdef __STDC__
28f540f4 137#define P(x) x
a334319f
UD
138#endif /* defined __STDC__ */
139#ifndef __STDC__
140#define P(x) ()
141#endif /* !defined __STDC__ */
28f540f4
RM
142#endif /* !defined P */
143
144/*
6c2f0507 145** SunOS 4.1.1 headers lack EXIT_SUCCESS.
28f540f4
RM
146*/
147
6c2f0507
RM
148#ifndef EXIT_SUCCESS
149#define EXIT_SUCCESS 0
150#endif /* !defined EXIT_SUCCESS */
28f540f4 151
6c2f0507
RM
152/*
153** SunOS 4.1.1 headers lack EXIT_FAILURE.
154*/
28f540f4 155
6c2f0507
RM
156#ifndef EXIT_FAILURE
157#define EXIT_FAILURE 1
158#endif /* !defined EXIT_FAILURE */
159
160/*
161** SunOS 4.1.1 headers lack FILENAME_MAX.
162*/
28f540f4
RM
163
164#ifndef FILENAME_MAX
165
166#ifndef MAXPATHLEN
167#ifdef unix
168#include "sys/param.h"
169#endif /* defined unix */
170#endif /* !defined MAXPATHLEN */
171
172#ifdef MAXPATHLEN
173#define FILENAME_MAX MAXPATHLEN
174#endif /* defined MAXPATHLEN */
175#ifndef MAXPATHLEN
176#define FILENAME_MAX 1024 /* Pure guesswork */
177#endif /* !defined MAXPATHLEN */
178
179#endif /* !defined FILENAME_MAX */
180
28f540f4 181/*
6c2f0507 182** SunOS 4.1.1 libraries lack remove.
28f540f4
RM
183*/
184
6c2f0507
RM
185#ifndef remove
186extern int unlink P((const char * filename));
187#define remove unlink
188#endif /* !defined remove */
28f540f4 189
92777700
RM
190/*
191** Some ancient errno.h implementations don't declare errno.
192** But some newer errno.h implementations define it as a macro.
193** Fix the former without affecting the latter.
194*/
daa6fd88 195
92777700
RM
196#ifndef errno
197extern int errno;
198#endif /* !defined errno */
199
daa6fd88
UD
200/*
201** Some time.h implementations don't declare asctime_r.
202** Others might define it as a macro.
203** Fix the former without affecting the latter.
204*/
205
206#ifndef asctime_r
207extern char * asctime_r();
208#endif
209
4cca6b86
UD
210/*
211** Private function declarations.
212*/
792dcd77 213
a334319f
UD
214char * icalloc P((int nelem, int elsize));
215char * icatalloc P((char * old, const char * new));
216char * icpyalloc P((const char * string));
217char * imalloc P((int n));
218void * irealloc P((void * pointer, int size));
219void icfree P((char * pointer));
220void ifree P((char * pointer));
026b372a 221const char *scheck P((const char *string, const char *format));
5929563f 222
6c2f0507
RM
223/*
224** Finally, some convenience items.
225*/
28f540f4
RM
226
227#ifndef TRUE
228#define TRUE 1
229#endif /* !defined TRUE */
230
231#ifndef FALSE
232#define FALSE 0
233#endif /* !defined FALSE */
234
f2e235b9
RM
235#ifndef TYPE_BIT
236#define TYPE_BIT(type) (sizeof (type) * CHAR_BIT)
237#endif /* !defined TYPE_BIT */
238
239#ifndef TYPE_SIGNED
240#define TYPE_SIGNED(type) (((type) -1) < 0)
241#endif /* !defined TYPE_SIGNED */
242
792dcd77
UD
243/*
244** Since the definition of TYPE_INTEGRAL contains floating point numbers,
245** it cannot be used in preprocessor directives.
246*/
247
248#ifndef TYPE_INTEGRAL
249#define TYPE_INTEGRAL(type) (((type) 0.5) != 0.5)
250#endif /* !defined TYPE_INTEGRAL */
251
28f540f4
RM
252#ifndef INT_STRLEN_MAXIMUM
253/*
254** 302 / 1000 is log10(2.0) rounded up.
f2e235b9 255** Subtract one for the sign bit if the type is signed;
28f540f4 256** add one for integer division truncation;
f2e235b9 257** add one more for a minus sign if the type is signed.
28f540f4
RM
258*/
259#define INT_STRLEN_MAXIMUM(type) \
c872f5cc
UD
260 ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + \
261 1 + TYPE_SIGNED(type))
28f540f4
RM
262#endif /* !defined INT_STRLEN_MAXIMUM */
263
6c2f0507
RM
264/*
265** INITIALIZE(x)
266*/
267
268#ifndef GNUC_or_lint
269#ifdef lint
270#define GNUC_or_lint
271#endif /* defined lint */
272#ifndef lint
273#ifdef __GNUC__
274#define GNUC_or_lint
275#endif /* defined __GNUC__ */
276#endif /* !defined lint */
277#endif /* !defined GNUC_or_lint */
278
279#ifndef INITIALIZE
280#ifdef GNUC_or_lint
281#define INITIALIZE(x) ((x) = 0)
282#endif /* defined GNUC_or_lint */
283#ifndef GNUC_or_lint
284#define INITIALIZE(x)
285#endif /* !defined GNUC_or_lint */
286#endif /* !defined INITIALIZE */
28f540f4 287
a182affd
RM
288/*
289** For the benefit of GNU folk...
92777700
RM
290** `_(MSGID)' uses the current locale's message library string for MSGID.
291** The default is to use gettext if available, and use MSGID otherwise.
a182affd
RM
292*/
293
294#ifndef _
c872f5cc 295#if HAVE_GETTEXT
92777700 296#define _(msgid) gettext(msgid)
c872f5cc 297#else /* !HAVE_GETTEXT */
92777700 298#define _(msgid) msgid
c872f5cc 299#endif /* !HAVE_GETTEXT */
a182affd
RM
300#endif /* !defined _ */
301
92777700
RM
302#ifndef TZ_DOMAIN
303#define TZ_DOMAIN "tz"
304#endif /* !defined TZ_DOMAIN */
305
eb0ad543
UD
306#if HAVE_INCOMPATIBLE_CTIME_R
307#undef asctime_r
308#undef ctime_r
309char *asctime_r P((struct tm const *, char *));
310char *ctime_r P((time_t const *, char *));
311#endif /* HAVE_INCOMPATIBLE_CTIME_R */
312
28f540f4 313/*
d1091a21 314** UNIX was a registered trademark of The Open Group in 2003.
28f540f4
RM
315*/
316
317#endif /* !defined PRIVATE_H */