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