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