3 * $FreeBSD: src/lib/libc/stdtime/private.h,v 1.6.8.1 2000/08/23 00:19:15 jhb Exp $
4 * $DragonFly: src/usr.sbin/zic/private.h,v 1.4 2008/10/19 20:15:58 swildner Exp $
11 ** This file is in the public domain, so clarified as of
12 ** 1996-06-05 by Arthur David Olson.
15 /* Stuff moved from Makefile.inc to reduce clutter */
17 #define TM_GMTOFF tm_gmtoff
18 #define TM_ZONE tm_zone
19 #define TZDIR "/usr/share/zoneinfo"
20 #endif /* ndef TM_GMTOFF */
23 ** This header is for use ONLY with the time conversion code.
24 ** There is no guarantee that it will remain unchanged,
25 ** or that it will remain at all.
26 ** Do NOT copy it to any system include directory.
30 #define GRANDPARENTED "Local time zone must be set--see zic manual page"
36 #include "sys/types.h" /* for time_t */
40 #include "limits.h" /* for CHAR_BIT et al. */
44 #include <sys/wait.h> /* for WIFEXITED and WEXITSTATUS */
46 #include "unistd.h" /* for F_OK, R_OK, and other POSIX goodness */
48 /* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */
49 #define is_digit(c) ((unsigned)(c) - '0' <= 9)
54 ** Private function declarations.
57 char * icalloc(int nelem
, int elsize
);
58 char * icatalloc(char * old
, const char * new);
59 char * icpyalloc(const char * string
);
60 char * imalloc(int n
);
61 void * irealloc(void * pointer
, int size
);
62 void icfree(char * pointer
);
63 void ifree(char * pointer
);
64 const char * scheck(const char * string
, const char * format
);
67 ** Finally, some convenience items.
72 #endif /* !defined TRUE */
76 #endif /* !defined FALSE */
79 #define TYPE_BIT(type) (sizeof (type) * CHAR_BIT)
80 #endif /* !defined TYPE_BIT */
83 #define TYPE_SIGNED(type) (((type) -1) < 0)
84 #endif /* !defined TYPE_SIGNED */
87 ** Since the definition of TYPE_INTEGRAL contains floating point numbers,
88 ** it cannot be used in preprocessor directives.
92 #define TYPE_INTEGRAL(type) (((type) 0.5) != 0.5)
93 #endif /* !defined TYPE_INTEGRAL */
95 #ifndef INT_STRLEN_MAXIMUM
97 ** 302 / 1000 is log10(2.0) rounded up.
98 ** Subtract one for the sign bit if the type is signed;
99 ** add one for integer division truncation;
100 ** add one more for a minus sign if the type is signed.
102 #define INT_STRLEN_MAXIMUM(type) \
103 ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + \
104 1 + TYPE_SIGNED(type))
105 #endif /* !defined INT_STRLEN_MAXIMUM */
114 #endif /* defined lint */
118 #endif /* defined __GNUC__ */
119 #endif /* !defined lint */
120 #endif /* !defined GNUC_or_lint */
124 #define INITIALIZE(x) ((x) = 0)
125 #endif /* defined GNUC_or_lint */
127 #define INITIALIZE(x)
128 #endif /* !defined GNUC_or_lint */
129 #endif /* !defined INITIALIZE */
132 ** For the benefit of GNU folk...
133 ** `_(MSGID)' uses the current locale's message library string for MSGID.
134 ** The default is to use gettext if available, and use MSGID otherwise.
138 #define _(msgid) msgid
139 #endif /* !defined _ */
142 #define TZ_DOMAIN "tz"
143 #endif /* !defined TZ_DOMAIN */
145 #define YEARSPERREPEAT 400 /* years before a Gregorian repeat */
148 ** UNIX was a registered trademark of The Open Group in 2003.
151 #endif /* !defined PRIVATE_H */