]> git.saurik.com Git - apple/libc.git/blame - stdtime/FreeBSD/private.h
Libc-339.tar.gz
[apple/libc.git] / stdtime / FreeBSD / private.h
CommitLineData
5b2abdfb
A
1#ifndef PRIVATE_H
2
3#define PRIVATE_H
4/*
5** This file is in the public domain, so clarified as of
6** June 5, 1996 by Arthur David Olson (arthur_david_olson@nih.gov).
9385eb3d
A
7**
8** $FreeBSD: src/lib/libc/stdtime/private.h,v 1.9 2002/05/28 16:59:40 alfred Exp $
5b2abdfb
A
9*/
10
11/* Stuff moved from Makefile.inc to reduce clutter */
12#ifndef TM_GMTOFF
13#define TM_GMTOFF tm_gmtoff
14#define TM_ZONE tm_zone
15#define STD_INSPIRED 1
16#define PCTS 1
17#define HAVE_LONG_DOUBLE 1
18#define HAVE_STRERROR 1
19#define HAVE_UNISTD_H 1
20#define LOCALE_HOME _PATH_LOCALE
21#define TZDIR "/usr/share/zoneinfo"
22#endif /* ndef TM_GMTOFF */
23
24/*
25** This header is for use ONLY with the time conversion code.
26** There is no guarantee that it will remain unchanged,
27** or that it will remain at all.
28** Do NOT copy it to any system include directory.
29** Thank you!
30*/
31
32/*
33** ID
34*/
35
36#ifndef lint
37#ifndef NOID
38/*
39static char privatehid[] = "@(#)private.h 7.43";
40*/
41#endif /* !defined NOID */
42#endif /* !defined lint */
43
44/*
45** Defaults for preprocessor symbols.
46** You can override these in your C compiler options, e.g. `-DHAVE_ADJTIME=0'.
47*/
48
49#ifndef HAVE_ADJTIME
50#define HAVE_ADJTIME 1
51#endif /* !defined HAVE_ADJTIME */
52
53#ifndef HAVE_GETTEXT
54#define HAVE_GETTEXT 0
55#endif /* !defined HAVE_GETTEXT */
56
57#ifndef HAVE_SETTIMEOFDAY
58#define HAVE_SETTIMEOFDAY 3
59#endif /* !defined HAVE_SETTIMEOFDAY */
60
61#ifndef HAVE_STRERROR
62#define HAVE_STRERROR 0
63#endif /* !defined HAVE_STRERROR */
64
65#ifndef HAVE_UNISTD_H
66#define HAVE_UNISTD_H 1
67#endif /* !defined HAVE_UNISTD_H */
68
69#ifndef HAVE_UTMPX_H
70#define HAVE_UTMPX_H 0
71#endif /* !defined HAVE_UTMPX_H */
72
73#ifndef LOCALE_HOME
74#define LOCALE_HOME "/usr/lib/locale"
75#endif /* !defined LOCALE_HOME */
76
77/*
78** Nested includes
79*/
80
81#include "sys/types.h" /* for time_t */
82#include "stdio.h"
83#include "errno.h"
84#include "string.h"
85#include "limits.h" /* for CHAR_BIT */
86#include "time.h"
87#include "stdlib.h"
88
89#if HAVE_GETTEXT - 0
90#include "libintl.h"
91#endif /* HAVE_GETTEXT - 0 */
92
93#if HAVE_UNISTD_H - 0
94#include "unistd.h" /* for F_OK and R_OK */
95#endif /* HAVE_UNISTD_H - 0 */
96
97#if !(HAVE_UNISTD_H - 0)
98#ifndef F_OK
99#define F_OK 0
100#endif /* !defined F_OK */
101#ifndef R_OK
102#define R_OK 4
103#endif /* !defined R_OK */
104#endif /* !(HAVE_UNISTD_H - 0) */
105
106/* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */
107#define is_digit(c) ((unsigned)(c) - '0' <= 9)
108
5b2abdfb
A
109/*
110** SunOS 4.1.1 headers lack FILENAME_MAX.
111*/
112
113#ifndef FILENAME_MAX
114
115#ifndef MAXPATHLEN
116#ifdef unix
117#include "sys/param.h"
118#endif /* defined unix */
119#endif /* !defined MAXPATHLEN */
120
121#ifdef MAXPATHLEN
122#define FILENAME_MAX MAXPATHLEN
123#endif /* defined MAXPATHLEN */
124#ifndef MAXPATHLEN
125#define FILENAME_MAX 1024 /* Pure guesswork */
126#endif /* !defined MAXPATHLEN */
127
128#endif /* !defined FILENAME_MAX */
129
130/*
131** Finally, some convenience items.
132*/
133
134#ifndef TRUE
135#define TRUE 1
136#endif /* !defined TRUE */
137
138#ifndef FALSE
139#define FALSE 0
140#endif /* !defined FALSE */
141
142#ifndef TYPE_BIT
143#define TYPE_BIT(type) (sizeof (type) * CHAR_BIT)
144#endif /* !defined TYPE_BIT */
145
146#ifndef TYPE_SIGNED
147#define TYPE_SIGNED(type) (((type) -1) < 0)
148#endif /* !defined TYPE_SIGNED */
149
150#ifndef INT_STRLEN_MAXIMUM
151/*
152** 302 / 1000 is log10(2.0) rounded up.
153** Subtract one for the sign bit if the type is signed;
154** add one for integer division truncation;
155** add one more for a minus sign if the type is signed.
156*/
157#define INT_STRLEN_MAXIMUM(type) \
158 ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + 1 + TYPE_SIGNED(type))
159#endif /* !defined INT_STRLEN_MAXIMUM */
160
161/*
162** INITIALIZE(x)
163*/
164
165#ifndef GNUC_or_lint
166#ifdef lint
167#define GNUC_or_lint
168#endif /* defined lint */
169#ifndef lint
170#ifdef __GNUC__
171#define GNUC_or_lint
172#endif /* defined __GNUC__ */
173#endif /* !defined lint */
174#endif /* !defined GNUC_or_lint */
175
176#ifndef INITIALIZE
177#ifdef GNUC_or_lint
178#define INITIALIZE(x) ((x) = 0)
179#endif /* defined GNUC_or_lint */
180#ifndef GNUC_or_lint
181#define INITIALIZE(x)
182#endif /* !defined GNUC_or_lint */
183#endif /* !defined INITIALIZE */
184
185/*
186** For the benefit of GNU folk...
187** `_(MSGID)' uses the current locale's message library string for MSGID.
188** The default is to use gettext if available, and use MSGID otherwise.
189*/
190
191#ifndef _
192#if HAVE_GETTEXT - 0
193#define _(msgid) gettext(msgid)
194#else /* !(HAVE_GETTEXT - 0) */
195#define _(msgid) msgid
196#endif /* !(HAVE_GETTEXT - 0) */
197#endif /* !defined _ */
198
199#ifndef TZ_DOMAIN
200#define TZ_DOMAIN "tz"
201#endif /* !defined TZ_DOMAIN */
202
203/*
204** UNIX was a registered trademark of UNIX System Laboratories in 1993.
205*/
206
207#endif /* !defined PRIVATE_H */