xref: /netbsd-src/lib/libc/time/private.h (revision ce0bb6e8d2e560ecacbe865a848624f94498063b)
1 /*	$NetBSD: private.h,v 1.3 1995/03/14 18:49:49 jtc Exp $	*/
2 
3 #ifndef PRIVATE_H
4 #define PRIVATE_H
5 
6 /* NetBSD defaults */
7 #define TM_GMTOFF	tm_gmtoff
8 #define TM_ZONE		tm_zone
9 #define STD_INSPIRED	1
10 #define HAVE_LONG_DOUBLE 1
11 
12 /*
13 ** This header is for use ONLY with the time conversion code.
14 ** There is no guarantee that it will remain unchanged,
15 ** or that it will remain at all.
16 ** Do NOT copy it to any system include directory.
17 ** Thank you!
18 */
19 
20 /*
21 ** ID
22 */
23 
24 #ifndef lint
25 #ifndef NOID
26 static char	privatehid[] = "@(#)private.h	7.33";
27 #endif /* !defined NOID */
28 #endif /* !defined lint */
29 
30 /*
31 ** Defaults for preprocessor symbols.
32 ** You can override these in your C compiler options, e.g. `-DHAVE_ADJTIME=0'.
33 */
34 
35 #ifndef HAVE_ADJTIME
36 #define HAVE_ADJTIME		1
37 #endif /* !defined HAVE_ADJTIME */
38 
39 #ifndef HAVE_SETTIMEOFDAY
40 #define HAVE_SETTIMEOFDAY	3
41 #endif /* !defined HAVE_SETTIMEOFDAY */
42 
43 #ifndef HAVE_UNISTD_H
44 #define HAVE_UNISTD_H		1
45 #endif /* !defined HAVE_UNISTD_H */
46 
47 #ifndef LOCALE_HOME
48 #define LOCALE_HOME		"/usr/lib/locale"
49 #endif /* !defined LOCALE_HOME */
50 
51 /*
52 ** Nested includes
53 */
54 
55 #include "sys/types.h"	/* for time_t */
56 #include "stdio.h"
57 #include "ctype.h"
58 #include "errno.h"
59 #include "string.h"
60 #include "limits.h"	/* for CHAR_BIT */
61 #include "time.h"
62 #include "stdlib.h"
63 
64 #if HAVE_UNISTD_H - 0
65 #include "unistd.h"	/* for F_OK and R_OK */
66 #endif /* HAVE_UNISTD_H - 0 */
67 
68 #if !(HAVE_UNISTD_H - 0)
69 #ifndef F_OK
70 #define F_OK	0
71 #endif /* !defined F_OK */
72 #ifndef R_OK
73 #define R_OK	4
74 #endif /* !defined R_OK */
75 #endif /* !(HAVE_UNISTD_H - 0) */
76 
77 /*
78 ** Workarounds for compilers/systems.
79 */
80 
81 /*
82 ** SunOS 4.1.1 cc lacks const.
83 */
84 
85 #ifndef const
86 #ifndef __STDC__
87 #define const
88 #endif /* !defined __STDC__ */
89 #endif /* !defined const */
90 
91 /*
92 ** SunOS 4.1.1 cc lacks prototypes.
93 */
94 
95 #ifndef P
96 #ifdef __STDC__
97 #define P(x)	x
98 #endif /* defined __STDC__ */
99 #ifndef __STDC__
100 #define P(x)	()
101 #endif /* !defined __STDC__ */
102 #endif /* !defined P */
103 
104 /*
105 ** SunOS 4.1.1 headers lack EXIT_SUCCESS.
106 */
107 
108 #ifndef EXIT_SUCCESS
109 #define EXIT_SUCCESS	0
110 #endif /* !defined EXIT_SUCCESS */
111 
112 /*
113 ** SunOS 4.1.1 headers lack EXIT_FAILURE.
114 */
115 
116 #ifndef EXIT_FAILURE
117 #define EXIT_FAILURE	1
118 #endif /* !defined EXIT_FAILURE */
119 
120 /*
121 ** SunOS 4.1.1 headers lack FILENAME_MAX.
122 */
123 
124 #ifndef FILENAME_MAX
125 
126 #ifndef MAXPATHLEN
127 #ifdef unix
128 #include "sys/param.h"
129 #endif /* defined unix */
130 #endif /* !defined MAXPATHLEN */
131 
132 #ifdef MAXPATHLEN
133 #define FILENAME_MAX	MAXPATHLEN
134 #endif /* defined MAXPATHLEN */
135 #ifndef MAXPATHLEN
136 #define FILENAME_MAX	1024		/* Pure guesswork */
137 #endif /* !defined MAXPATHLEN */
138 
139 #endif /* !defined FILENAME_MAX */
140 
141 /*
142 ** SunOS 4.1.1 libraries lack remove.
143 */
144 
145 #ifndef remove
146 extern int	unlink P((const char * filename));
147 #define remove	unlink
148 #endif /* !defined remove */
149 
150 /*
151 ** Finally, some convenience items.
152 */
153 
154 #ifndef TRUE
155 #define TRUE	1
156 #endif /* !defined TRUE */
157 
158 #ifndef FALSE
159 #define FALSE	0
160 #endif /* !defined FALSE */
161 
162 #ifndef INT_STRLEN_MAXIMUM
163 /*
164 ** 302 / 1000 is log10(2.0) rounded up.
165 ** Subtract one for the sign bit;
166 ** add one for integer division truncation;
167 ** add one more for a minus sign.
168 */
169 #define INT_STRLEN_MAXIMUM(type) \
170 	((sizeof(type) * CHAR_BIT - 1) * 302 / 1000 + 2)
171 #endif /* !defined INT_STRLEN_MAXIMUM */
172 
173 /*
174 ** INITIALIZE(x)
175 */
176 
177 #ifndef GNUC_or_lint
178 #ifdef lint
179 #define GNUC_or_lint
180 #endif /* defined lint */
181 #ifndef lint
182 #ifdef __GNUC__
183 #define GNUC_or_lint
184 #endif /* defined __GNUC__ */
185 #endif /* !defined lint */
186 #endif /* !defined GNUC_or_lint */
187 
188 #ifndef INITIALIZE
189 #ifdef GNUC_or_lint
190 #define INITIALIZE(x)	((x) = 0)
191 #endif /* defined GNUC_or_lint */
192 #ifndef GNUC_or_lint
193 #define INITIALIZE(x)
194 #endif /* !defined GNUC_or_lint */
195 #endif /* !defined INITIALIZE */
196 
197 /*
198 ** UNIX was a registered trademark of UNIX System Laboratories in 1993.
199 */
200 
201 #endif /* !defined PRIVATE_H */
202