xref: /illumos-gate/usr/src/cmd/zic/private.h (revision 9c72db81a69bf1ea2a220c7cfc40eb0ef089be8c)
1 /*
2  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 #ifndef	_PRIVATE_H
7 #define	_PRIVATE_H
8 
9 /*
10  * This file is in the public domain, so clarified as of
11  * June 5, 1996 by Arthur David Olson (arthur_david_olson@nih.gov).
12  */
13 
14 /*
15  * This header is for use ONLY with the time conversion code.
16  * There is no guarantee that it will remain unchanged,
17  * or that it will remain at all.
18  * Do NOT copy it to any system include directory.
19  * Thank you!
20  */
21 
22 #ifdef	__cplusplus
23 extern "C" {
24 #endif
25 
26 /*
27  * Nested includes
28  */
29 #include <sys/types.h>	/* for time_t */
30 #include <stdio.h>
31 #include <errno.h>
32 #include <string.h>
33 #include <limits.h>	/* for CHAR_BIT */
34 #include <time.h>
35 #include <stdlib.h>
36 #include <libintl.h>	/* for F_OK and R_OK */
37 #include <unistd.h>
38 #include <sys/wait.h>
39 
40 /* static char	privatehid[] = "@(#)private.h	7.55"; */
41 
42 #define	GRANDPARENTED	"Local time zone must be set--see zic manual page"
43 
44 /* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX.  */
45 #define	is_digit(c)		((unsigned)(c) - '0' <= 9)
46 
47 /*
48  * Private function declarations.
49  */
50 char 	*icatalloc(char *old, const char *new);
51 char 	*icpyalloc(const char *string);
52 char 	*imalloc(int n);
53 void 	*irealloc(void *pointer, int size);
54 void	ifree(char *pointer);
55 const char	*scheck(const char *string, const char *format);
56 
57 /*
58  * Finally, some convenience items.
59  */
60 
61 #ifndef TRUE
62 #define	TRUE	1
63 #endif /* !defined TRUE */
64 
65 #ifndef FALSE
66 #define	FALSE	0
67 #endif /* !defined FALSE */
68 
69 #ifndef TYPE_BIT
70 #define	TYPE_BIT(type)	(sizeof (type) * CHAR_BIT)
71 #endif /* !defined TYPE_BIT */
72 
73 #ifndef TYPE_SIGNED
74 #define	TYPE_SIGNED(type) (((type) -1) < 0)
75 #endif /* !defined TYPE_SIGNED */
76 
77 /*
78  * INITIALIZE(x)
79  */
80 
81 #ifndef INITIALIZE
82 #ifdef lint
83 #define	INITIALIZE(x)	((x) = 0)
84 #endif /* defined lint */
85 #ifndef lint
86 #define	INITIALIZE(x)
87 #endif /* !defined lint */
88 #endif /* !defined INITIALIZE */
89 
90 #ifdef	__cplusplus
91 }
92 #endif
93 
94 #endif	/* _PRIVATE_H */
95