6 ** This file is in the public domain, so clarified as of
7 ** 1996-06-05 by Arthur David Olson.
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.
24 static char privatehid
[] = "@(#)private.h 7.55";
25 #endif /* !defined NOID */
26 #endif /* !defined lint */
28 #define GRANDPARENTED "Local time zone must be set--see zic manual page"
31 ** Defaults for preprocessor symbols.
32 ** You can override these in your C compiler options, e.g. `-DHAVE_ADJTIME=0'.
36 #define HAVE_ADJTIME 1
37 #endif /* !defined HAVE_ADJTIME */
40 #define HAVE_GETTEXT 0
41 #endif /* !defined HAVE_GETTEXT */
43 #ifndef HAVE_INCOMPATIBLE_CTIME_R
44 #define HAVE_INCOMPATIBLE_CTIME_R 0
45 #endif /* !defined INCOMPATIBLE_CTIME_R */
47 #ifndef HAVE_SETTIMEOFDAY
48 #define HAVE_SETTIMEOFDAY 3
49 #endif /* !defined HAVE_SETTIMEOFDAY */
52 #define HAVE_STRERROR 1
53 #endif /* !defined HAVE_STRERROR */
56 #define HAVE_SYMLINK 1
57 #endif /* !defined HAVE_SYMLINK */
59 #ifndef HAVE_SYS_STAT_H
60 #define HAVE_SYS_STAT_H 1
61 #endif /* !defined HAVE_SYS_STAT_H */
63 #ifndef HAVE_SYS_WAIT_H
64 #define HAVE_SYS_WAIT_H 1
65 #endif /* !defined HAVE_SYS_WAIT_H */
68 #define HAVE_UNISTD_H 1
69 #endif /* !defined HAVE_UNISTD_H */
72 #define HAVE_UTMPX_H 0
73 #endif /* !defined HAVE_UTMPX_H */
76 #define LOCALE_HOME "/usr/lib/locale"
77 #endif /* !defined LOCALE_HOME */
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 */
88 #include "sys/types.h" /* for time_t */
92 #include "limits.h" /* for CHAR_BIT */
98 #endif /* HAVE_GETTEXT */
101 #include <sys/wait.h> /* for WIFEXITED and WEXITSTATUS */
102 #endif /* HAVE_SYS_WAIT_H */
105 #define WIFEXITED(status) (((status) & 0xff) == 0)
106 #endif /* !defined WIFEXITED */
108 #define WEXITSTATUS(status) (((status) >> 8) & 0xff)
109 #endif /* !defined WEXITSTATUS */
112 #include "unistd.h" /* for F_OK and R_OK */
113 #endif /* HAVE_UNISTD_H */
118 #endif /* !defined F_OK */
121 #endif /* !defined R_OK */
122 #endif /* !HAVE_UNISTD_H */
124 /* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */
125 #define is_digit(c) ((unsigned)(c) - '0' <= 9)
128 ** Workarounds for compilers/systems.
132 ** SunOS 4.1.1 cc lacks prototypes.
138 #else /* !__STDC__ */
140 #endif /* !__STDC__ */
141 #endif /* !defined P */
144 ** SunOS 4.1.1 headers lack EXIT_SUCCESS.
148 #define EXIT_SUCCESS 0
149 #endif /* !defined EXIT_SUCCESS */
152 ** SunOS 4.1.1 headers lack EXIT_FAILURE.
156 #define EXIT_FAILURE 1
157 #endif /* !defined EXIT_FAILURE */
160 ** SunOS 4.1.1 headers lack FILENAME_MAX.
167 #include "sys/param.h"
168 #endif /* defined unix */
169 #endif /* !defined MAXPATHLEN */
172 #define FILENAME_MAX MAXPATHLEN
173 #endif /* defined MAXPATHLEN */
175 #define FILENAME_MAX 1024 /* Pure guesswork */
176 #endif /* !defined MAXPATHLEN */
178 #endif /* !defined FILENAME_MAX */
181 ** SunOS 4.1.1 libraries lack remove.
185 extern int unlink
P((const char * filename
));
186 #define remove unlink
187 #endif /* !defined remove */
190 ** Some ancient errno.h implementations don't declare errno.
191 ** But some newer errno.h implementations define it as a macro.
192 ** Fix the former without affecting the latter.
197 #endif /* !defined errno */
200 ** Some time.h implementations don't declare asctime_r.
201 ** Others might define it as a macro.
202 ** Fix the former without affecting the latter.
206 extern char * asctime_r();
210 ** Private function declarations.
213 char * icalloc
P((int nelem
, int elsize
));
214 char * icatalloc
P((char * old
, const char * new));
215 char * icpyalloc
P((const char * string
));
216 char * imalloc
P((int n
));
217 void * irealloc
P((void * pointer
, int size
));
218 void icfree
P((char * pointer
));
219 void ifree
P((char * pointer
));
220 const char *scheck
P((const char *string
, const char *format
));
223 ** Finally, some convenience items.
228 #endif /* !defined TRUE */
232 #endif /* !defined FALSE */
235 #define TYPE_BIT(type) (sizeof (type) * CHAR_BIT)
236 #endif /* !defined TYPE_BIT */
239 #define TYPE_SIGNED(type) (((type) -1) < 0)
240 #endif /* !defined TYPE_SIGNED */
243 ** Since the definition of TYPE_INTEGRAL contains floating point numbers,
244 ** it cannot be used in preprocessor directives.
247 #ifndef TYPE_INTEGRAL
248 #define TYPE_INTEGRAL(type) (((type) 0.5) != 0.5)
249 #endif /* !defined TYPE_INTEGRAL */
251 #ifndef INT_STRLEN_MAXIMUM
253 ** 302 / 1000 is log10(2.0) rounded up.
254 ** Subtract one for the sign bit if the type is signed;
255 ** add one for integer division truncation;
256 ** add one more for a minus sign if the type is signed.
258 #define INT_STRLEN_MAXIMUM(type) \
259 ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + \
260 1 + TYPE_SIGNED(type))
261 #endif /* !defined INT_STRLEN_MAXIMUM */
270 #endif /* defined lint */
274 #endif /* defined __GNUC__ */
275 #endif /* !defined lint */
276 #endif /* !defined GNUC_or_lint */
280 #define INITIALIZE(x) ((x) = 0)
281 #endif /* defined GNUC_or_lint */
283 #define INITIALIZE(x)
284 #endif /* !defined GNUC_or_lint */
285 #endif /* !defined INITIALIZE */
288 ** For the benefit of GNU folk...
289 ** `_(MSGID)' uses the current locale's message library string for MSGID.
290 ** The default is to use gettext if available, and use MSGID otherwise.
295 #define _(msgid) gettext(msgid)
296 #else /* !HAVE_GETTEXT */
297 #define _(msgid) msgid
298 #endif /* !HAVE_GETTEXT */
299 #endif /* !defined _ */
302 #define TZ_DOMAIN "tz"
303 #endif /* !defined TZ_DOMAIN */
305 #if HAVE_INCOMPATIBLE_CTIME_R
308 char *asctime_r
P((struct tm
const *, char *));
309 char *ctime_r
P((time_t const *, char *));
310 #endif /* HAVE_INCOMPATIBLE_CTIME_R */
313 ** UNIX was a registered trademark of The Open Group in 2003.
316 #endif /* !defined PRIVATE_H */