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).
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.53";
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'.
34 #define HAVE_ADJTIME 1
35 #endif /* !defined HAVE_ADJTIME */
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 */
50 #define HAVE_STRERROR 1
51 #endif /* !defined HAVE_STRERROR */
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 */
66 #define HAVE_UNISTD_H 1
67 #endif /* !defined HAVE_UNISTD_H */
70 #define HAVE_UTMPX_H 0
71 #endif /* !defined HAVE_UTMPX_H */
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 */
86 #include "sys/types.h" /* for time_t */
90 #include "limits.h" /* for CHAR_BIT */
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 */
103 #define WIFEXITED(status) (((status) & 0xff) == 0)
104 #endif /* !defined WIFEXITED */
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)
116 #endif /* !defined F_OK */
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.
136 #endif /* defined __STDC__ */
139 #endif /* !defined __STDC__ */
140 #endif /* !defined P */
143 ** SunOS 4.1.1 headers lack EXIT_SUCCESS.
147 #define EXIT_SUCCESS 0
148 #endif /* !defined EXIT_SUCCESS */
151 ** SunOS 4.1.1 headers lack EXIT_FAILURE.
155 #define EXIT_FAILURE 1
156 #endif /* !defined EXIT_FAILURE */
159 ** SunOS 4.1.1 headers lack FILENAME_MAX.
166 #include "sys/param.h"
167 #endif /* defined unix */
168 #endif /* !defined MAXPATHLEN */
171 #define FILENAME_MAX MAXPATHLEN
172 #endif /* defined 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.
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.
195 #endif /* !defined errno */
198 ** Private function declarations.
200 char * icalloc
P((int nelem
, int elsize
));
201 char * icatalloc
P((char * old
, const char * new));
202 char * icpyalloc
P((const char * string
));
203 char * imalloc
P((int n
));
204 void * irealloc
P((void * pointer
, int size
));
205 void icfree
P((char * pointer
));
206 void ifree
P((char * pointer
));
207 char * scheck
P((const char *string
, const char *format
));
211 ** Finally, some convenience items.
216 #endif /* !defined TRUE */
220 #endif /* !defined FALSE */
223 #define TYPE_BIT(type) (sizeof (type) * CHAR_BIT)
224 #endif /* !defined TYPE_BIT */
227 #define TYPE_SIGNED(type) (((type) -1) < 0)
228 #endif /* !defined TYPE_SIGNED */
230 #ifndef INT_STRLEN_MAXIMUM
232 ** 302 / 1000 is log10(2.0) rounded up.
233 ** Subtract one for the sign bit if the type is signed;
234 ** add one for integer division truncation;
235 ** add one more for a minus sign if the type is signed.
237 #define INT_STRLEN_MAXIMUM(type) \
238 ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + 1 + TYPE_SIGNED(type))
239 #endif /* !defined INT_STRLEN_MAXIMUM */
248 #endif /* defined lint */
252 #endif /* defined __GNUC__ */
253 #endif /* !defined lint */
254 #endif /* !defined GNUC_or_lint */
258 #define INITIALIZE(x) ((x) = 0)
259 #endif /* defined GNUC_or_lint */
261 #define INITIALIZE(x)
262 #endif /* !defined GNUC_or_lint */
263 #endif /* !defined INITIALIZE */
266 ** For the benefit of GNU folk...
267 ** `_(MSGID)' uses the current locale's message library string for MSGID.
268 ** The default is to use gettext if available, and use MSGID otherwise.
273 #define _(msgid) gettext(msgid)
274 #else /* !(HAVE_GETTEXT - 0) */
275 #define _(msgid) msgid
276 #endif /* !(HAVE_GETTEXT - 0) */
277 #endif /* !defined _ */
280 #define TZ_DOMAIN "tz"
281 #endif /* !defined TZ_DOMAIN */
283 #if HAVE_INCOMPATIBLE_CTIME_R
286 char *asctime_r
P((struct tm
const *, char *));
287 char *ctime_r
P((time_t const *, char *));
288 #endif /* HAVE_INCOMPATIBLE_CTIME_R */
291 ** UNIX was a registered trademark of The Open Group in 2003.
294 #endif /* !defined PRIVATE_H */