usb4bsd: Add a commented out line to our configs for enabling usb4bsd.
[dragonfly.git] / usr.sbin / zic / private.h
blob968db47b8eb1fe3ef70b13143ec87aa6fef1b137
1 /*
2 * $FreeBSD: src/lib/libc/stdtime/private.h,v 1.6.8.1 2000/08/23 00:19:15 jhb Exp $
3 */
5 #ifndef PRIVATE_H
7 #define PRIVATE_H
8 /*
9 ** This file is in the public domain, so clarified as of
10 ** 1996-06-05 by Arthur David Olson.
13 /* Stuff moved from Makefile.inc to reduce clutter */
14 #ifndef TM_GMTOFF
15 #define TM_GMTOFF tm_gmtoff
16 #define TM_ZONE tm_zone
17 #define TZDIR "/usr/share/zoneinfo"
18 #endif /* ndef TM_GMTOFF */
21 ** This header is for use ONLY with the time conversion code.
22 ** There is no guarantee that it will remain unchanged,
23 ** or that it will remain at all.
24 ** Do NOT copy it to any system include directory.
25 ** Thank you!
28 #define GRANDPARENTED "Local time zone must be set--see zic manual page"
31 ** Nested includes
34 #include "sys/types.h" /* for time_t */
35 #include "stdio.h"
36 #include "errno.h"
37 #include "string.h"
38 #include "limits.h" /* for CHAR_BIT et al. */
39 #include "time.h"
40 #include "stdlib.h"
42 #include <sys/wait.h> /* for WIFEXITED and WEXITSTATUS */
44 #include "unistd.h" /* for F_OK, R_OK, and other POSIX goodness */
46 /* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */
47 #define is_digit(c) ((unsigned)(c) - '0' <= 9)
49 #include "stdint.h"
52 ** Private function declarations.
55 char * icalloc(int nelem, int elsize);
56 char * icatalloc(char * old, const char * new);
57 char * icpyalloc(const char * string);
58 char * imalloc(int n);
59 void * irealloc(void * pointer, int size);
60 void icfree(char * pointer);
61 void ifree(char * pointer);
62 const char * scheck(const char * string, const char * format);
65 ** Finally, some convenience items.
68 #ifndef TRUE
69 #define TRUE 1
70 #endif /* !defined TRUE */
72 #ifndef FALSE
73 #define FALSE 0
74 #endif /* !defined FALSE */
76 #ifndef TYPE_BIT
77 #define TYPE_BIT(type) (sizeof (type) * CHAR_BIT)
78 #endif /* !defined TYPE_BIT */
80 #ifndef TYPE_SIGNED
81 #define TYPE_SIGNED(type) (((type) -1) < 0)
82 #endif /* !defined TYPE_SIGNED */
85 ** Since the definition of TYPE_INTEGRAL contains floating point numbers,
86 ** it cannot be used in preprocessor directives.
89 #ifndef TYPE_INTEGRAL
90 #define TYPE_INTEGRAL(type) (((type) 0.5) != 0.5)
91 #endif /* !defined TYPE_INTEGRAL */
93 #ifndef INT_STRLEN_MAXIMUM
95 ** 302 / 1000 is log10(2.0) rounded up.
96 ** Subtract one for the sign bit if the type is signed;
97 ** add one for integer division truncation;
98 ** add one more for a minus sign if the type is signed.
100 #define INT_STRLEN_MAXIMUM(type) \
101 ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + \
102 1 + TYPE_SIGNED(type))
103 #endif /* !defined INT_STRLEN_MAXIMUM */
106 ** INITIALIZE(x)
109 #ifndef GNUC_or_lint
110 #ifdef lint
111 #define GNUC_or_lint
112 #endif /* defined lint */
113 #ifndef lint
114 #ifdef __GNUC__
115 #define GNUC_or_lint
116 #endif /* defined __GNUC__ */
117 #endif /* !defined lint */
118 #endif /* !defined GNUC_or_lint */
120 #ifndef INITIALIZE
121 #ifdef GNUC_or_lint
122 #define INITIALIZE(x) ((x) = 0)
123 #endif /* defined GNUC_or_lint */
124 #ifndef GNUC_or_lint
125 #define INITIALIZE(x)
126 #endif /* !defined GNUC_or_lint */
127 #endif /* !defined INITIALIZE */
130 ** For the benefit of GNU folk...
131 ** `_(MSGID)' uses the current locale's message library string for MSGID.
132 ** The default is to use gettext if available, and use MSGID otherwise.
135 #ifndef _
136 #define _(msgid) msgid
137 #endif /* !defined _ */
139 #ifndef TZ_DOMAIN
140 #define TZ_DOMAIN "tz"
141 #endif /* !defined TZ_DOMAIN */
143 #define YEARSPERREPEAT 400 /* years before a Gregorian repeat */
146 ** UNIX was a registered trademark of The Open Group in 2003.
149 #endif /* !defined PRIVATE_H */