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