]>
Commit | Line | Data |
---|---|---|
1815bff5 A |
1 | /* |
2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights | |
7 | * Reserved. This file contains Original Code and/or Modifications of | |
8 | * Original Code as defined in and that are subject to the Apple Public | |
9 | * Source License Version 1.0 (the 'License'). You may not use this file | |
10 | * except in compliance with the License. Please obtain a copy of the | |
11 | * License at http://www.apple.com/publicsource and read it before using | |
12 | * this file. | |
13 | * | |
14 | * The Original Code and all software distributed under the License are | |
15 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
16 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
17 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
18 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the | |
19 | * License for the specific language governing rights and limitations | |
20 | * under the License." | |
21 | * | |
22 | * @APPLE_LICENSE_HEADER_END@ | |
23 | */ | |
24 | /* $OpenBSD: private.h,v 1.6 1997/01/14 03:16:48 millert Exp $ */ | |
25 | ||
26 | #ifndef PRIVATE_H | |
27 | ||
28 | #define PRIVATE_H | |
29 | ||
30 | /* | |
31 | ** This file is in the public domain, so clarified as of | |
32 | ** 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov). | |
33 | */ | |
34 | ||
35 | /* OpenBSD defaults */ | |
36 | #define TM_GMTOFF tm_gmtoff | |
37 | #define TM_ZONE tm_zone | |
38 | #define PCTS 1 | |
39 | #define STD_INSPIRED 1 | |
40 | #define HAVE_LONG_DOUBLE 1 | |
41 | #define HAVE_STRERROR 1 | |
42 | ||
43 | /* | |
44 | ** This header is for use ONLY with the time conversion code. | |
45 | ** There is no guarantee that it will remain unchanged, | |
46 | ** or that it will remain at all. | |
47 | ** Do NOT copy it to any system include directory. | |
48 | ** Thank you! | |
49 | */ | |
50 | ||
51 | /* | |
52 | ** ID | |
53 | */ | |
54 | ||
55 | #if 0 | |
56 | #ifndef lint | |
57 | #ifndef NOID | |
58 | static char privatehid[] = "@(#)private.h 7.44"; | |
59 | #endif /* !defined NOID */ | |
60 | #endif /* !defined lint */ | |
61 | #endif | |
62 | ||
63 | /* | |
64 | ** Defaults for preprocessor symbols. | |
65 | ** You can override these in your C compiler options, e.g. `-DHAVE_ADJTIME=0'. | |
66 | */ | |
67 | ||
68 | #ifndef HAVE_ADJTIME | |
69 | #define HAVE_ADJTIME 1 | |
70 | #endif /* !defined HAVE_ADJTIME */ | |
71 | ||
72 | #ifndef HAVE_GETTEXT | |
73 | #define HAVE_GETTEXT 0 | |
74 | #endif /* !defined HAVE_GETTEXT */ | |
75 | ||
76 | #ifndef HAVE_SETTIMEOFDAY | |
77 | #define HAVE_SETTIMEOFDAY 3 | |
78 | #endif /* !defined HAVE_SETTIMEOFDAY */ | |
79 | ||
80 | #ifndef HAVE_STRERROR | |
81 | #define HAVE_STRERROR 0 | |
82 | #endif /* !defined HAVE_STRERROR */ | |
83 | ||
84 | #ifndef HAVE_UNISTD_H | |
85 | #define HAVE_UNISTD_H 1 | |
86 | #endif /* !defined HAVE_UNISTD_H */ | |
87 | ||
88 | #ifndef HAVE_UTMPX_H | |
89 | #define HAVE_UTMPX_H 0 | |
90 | #endif /* !defined HAVE_UTMPX_H */ | |
91 | ||
92 | #ifndef LOCALE_HOME | |
93 | #define LOCALE_HOME "/usr/lib/locale" | |
94 | #endif /* !defined LOCALE_HOME */ | |
95 | ||
96 | /* | |
97 | ** Nested includes | |
98 | */ | |
99 | ||
100 | #include "sys/types.h" /* for time_t */ | |
101 | #include "stdio.h" | |
102 | #include "errno.h" | |
103 | #include "string.h" | |
104 | #include "limits.h" /* for CHAR_BIT */ | |
105 | #include "time.h" | |
106 | #include "stdlib.h" | |
107 | ||
108 | #if HAVE_GETTEXT - 0 | |
109 | #include "libintl.h" | |
110 | #endif /* HAVE_GETTEXT - 0 */ | |
111 | ||
112 | #if HAVE_UNISTD_H - 0 | |
113 | #include "unistd.h" /* for F_OK and R_OK */ | |
114 | #endif /* HAVE_UNISTD_H - 0 */ | |
115 | ||
116 | #if !(HAVE_UNISTD_H - 0) | |
117 | #ifndef F_OK | |
118 | #define F_OK 0 | |
119 | #endif /* !defined F_OK */ | |
120 | #ifndef R_OK | |
121 | #define R_OK 4 | |
122 | #endif /* !defined R_OK */ | |
123 | #endif /* !(HAVE_UNISTD_H - 0) */ | |
124 | ||
125 | /* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */ | |
126 | #define is_digit(c) ((unsigned)(c) - '0' <= 9) | |
127 | ||
128 | /* | |
129 | ** Workarounds for compilers/systems. | |
130 | */ | |
131 | ||
132 | /* | |
133 | ** SunOS 4.1.1 cc lacks const. | |
134 | */ | |
135 | ||
136 | #ifndef const | |
137 | #ifndef __STDC__ | |
138 | #define const | |
139 | #endif /* !defined __STDC__ */ | |
140 | #endif /* !defined const */ | |
141 | ||
142 | /* | |
143 | ** SunOS 4.1.1 cc lacks prototypes. | |
144 | */ | |
145 | ||
146 | #ifndef P | |
147 | #ifdef __STDC__ | |
148 | #define P(x) x | |
149 | #endif /* defined __STDC__ */ | |
150 | #ifndef __STDC__ | |
151 | #define P(x) () | |
152 | #endif /* !defined __STDC__ */ | |
153 | #endif /* !defined P */ | |
154 | ||
155 | /* | |
156 | ** SunOS 4.1.1 headers lack EXIT_SUCCESS. | |
157 | */ | |
158 | ||
159 | #ifndef EXIT_SUCCESS | |
160 | #define EXIT_SUCCESS 0 | |
161 | #endif /* !defined EXIT_SUCCESS */ | |
162 | ||
163 | /* | |
164 | ** SunOS 4.1.1 headers lack EXIT_FAILURE. | |
165 | */ | |
166 | ||
167 | #ifndef EXIT_FAILURE | |
168 | #define EXIT_FAILURE 1 | |
169 | #endif /* !defined EXIT_FAILURE */ | |
170 | ||
171 | /* | |
172 | ** SunOS 4.1.1 headers lack FILENAME_MAX. | |
173 | */ | |
174 | ||
175 | #ifndef FILENAME_MAX | |
176 | ||
177 | #ifndef MAXPATHLEN | |
178 | #ifdef unix | |
179 | #include "sys/param.h" | |
180 | #endif /* defined unix */ | |
181 | #endif /* !defined MAXPATHLEN */ | |
182 | ||
183 | #ifdef MAXPATHLEN | |
184 | #define FILENAME_MAX MAXPATHLEN | |
185 | #endif /* defined MAXPATHLEN */ | |
186 | #ifndef MAXPATHLEN | |
187 | #define FILENAME_MAX 1024 /* Pure guesswork */ | |
188 | #endif /* !defined MAXPATHLEN */ | |
189 | ||
190 | #endif /* !defined FILENAME_MAX */ | |
191 | ||
192 | /* | |
193 | ** SunOS 4.1.1 libraries lack remove. | |
194 | */ | |
195 | ||
196 | #ifndef remove | |
197 | extern int unlink P((const char * filename)); | |
198 | #define remove unlink | |
199 | #endif /* !defined remove */ | |
200 | ||
201 | #if 0 | |
202 | /* | |
203 | ** Some ancient errno.h implementations don't declare errno. | |
204 | ** But some newer errno.h implementations define it as a macro. | |
205 | ** Fix the former without affecting the latter. | |
206 | */ | |
207 | #ifndef errno | |
208 | extern int errno; | |
209 | #endif /* !defined errno */ | |
210 | #endif | |
211 | ||
212 | /* | |
213 | ** Finally, some convenience items. | |
214 | */ | |
215 | ||
216 | #ifndef TRUE | |
217 | #define TRUE 1 | |
218 | #endif /* !defined TRUE */ | |
219 | ||
220 | #ifndef FALSE | |
221 | #define FALSE 0 | |
222 | #endif /* !defined FALSE */ | |
223 | ||
224 | #ifndef TYPE_BIT | |
225 | #define TYPE_BIT(type) (sizeof (type) * CHAR_BIT) | |
226 | #endif /* !defined TYPE_BIT */ | |
227 | ||
228 | #ifndef TYPE_SIGNED | |
229 | #define TYPE_SIGNED(type) (((type) -1) < 0) | |
230 | #endif /* !defined TYPE_SIGNED */ | |
231 | ||
232 | #ifndef INT_STRLEN_MAXIMUM | |
233 | /* | |
234 | ** 302 / 1000 is log10(2.0) rounded up. | |
235 | ** Subtract one for the sign bit if the type is signed; | |
236 | ** add one for integer division truncation; | |
237 | ** add one more for a minus sign if the type is signed. | |
238 | */ | |
239 | #define INT_STRLEN_MAXIMUM(type) \ | |
240 | ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 100 + 1 + TYPE_SIGNED(type)) | |
241 | #endif /* !defined INT_STRLEN_MAXIMUM */ | |
242 | ||
243 | /* | |
244 | ** INITIALIZE(x) | |
245 | */ | |
246 | ||
247 | #ifndef GNUC_or_lint | |
248 | #ifdef lint | |
249 | #define GNUC_or_lint | |
250 | #endif /* defined lint */ | |
251 | #ifndef lint | |
252 | #ifdef __GNUC__ | |
253 | #define GNUC_or_lint | |
254 | #endif /* defined __GNUC__ */ | |
255 | #endif /* !defined lint */ | |
256 | #endif /* !defined GNUC_or_lint */ | |
257 | ||
258 | #ifndef INITIALIZE | |
259 | #ifdef GNUC_or_lint | |
260 | #define INITIALIZE(x) ((x) = 0) | |
261 | #endif /* defined GNUC_or_lint */ | |
262 | #ifndef GNUC_or_lint | |
263 | #define INITIALIZE(x) | |
264 | #endif /* !defined GNUC_or_lint */ | |
265 | #endif /* !defined INITIALIZE */ | |
266 | ||
267 | /* | |
268 | ** For the benefit of GNU folk... | |
269 | ** `_(MSGID)' uses the current locale's message library string for MSGID. | |
270 | ** The default is to use gettext if available, and use MSGID otherwise. | |
271 | */ | |
272 | ||
273 | #ifndef _ | |
274 | #if HAVE_GETTEXT - 0 | |
275 | #define _(msgid) gettext(msgid) | |
276 | #else /* !(HAVE_GETTEXT - 0) */ | |
277 | #define _(msgid) msgid | |
278 | #endif /* !(HAVE_GETTEXT - 0) */ | |
279 | #endif /* !defined _ */ | |
280 | ||
281 | #ifndef TZ_DOMAIN | |
282 | #define TZ_DOMAIN "tz" | |
283 | #endif /* !defined TZ_DOMAIN */ | |
284 | ||
285 | /* | |
286 | ** UNIX was a registered trademark of UNIX System Laboratories in 1993. | |
287 | */ | |
288 | ||
289 | #endif /* !defined PRIVATE_H */ |