xref: /illumos-gate/usr/src/cmd/zic/private.h (revision 2a8bcb4e)
17c478bd9Sstevel@tonic-gate /*
2*f430f59aSrobbin  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
380868c53Srobbin  * Use is subject to license terms.
47c478bd9Sstevel@tonic-gate  */
57c478bd9Sstevel@tonic-gate 
67c478bd9Sstevel@tonic-gate #ifndef	_PRIVATE_H
77c478bd9Sstevel@tonic-gate #define	_PRIVATE_H
87c478bd9Sstevel@tonic-gate 
97c478bd9Sstevel@tonic-gate /*
107c478bd9Sstevel@tonic-gate  * This file is in the public domain, so clarified as of
117c478bd9Sstevel@tonic-gate  * June 5, 1996 by Arthur David Olson (arthur_david_olson@nih.gov).
127c478bd9Sstevel@tonic-gate  */
137c478bd9Sstevel@tonic-gate 
147c478bd9Sstevel@tonic-gate /*
157c478bd9Sstevel@tonic-gate  * This header is for use ONLY with the time conversion code.
167c478bd9Sstevel@tonic-gate  * There is no guarantee that it will remain unchanged,
177c478bd9Sstevel@tonic-gate  * or that it will remain at all.
187c478bd9Sstevel@tonic-gate  * Do NOT copy it to any system include directory.
197c478bd9Sstevel@tonic-gate  * Thank you!
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate 
227c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
237c478bd9Sstevel@tonic-gate extern "C" {
247c478bd9Sstevel@tonic-gate #endif
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate /*
277c478bd9Sstevel@tonic-gate  * Nested includes
287c478bd9Sstevel@tonic-gate  */
297c478bd9Sstevel@tonic-gate #include <sys/types.h>	/* for time_t */
307c478bd9Sstevel@tonic-gate #include <stdio.h>
317c478bd9Sstevel@tonic-gate #include <errno.h>
327c478bd9Sstevel@tonic-gate #include <string.h>
337c478bd9Sstevel@tonic-gate #include <limits.h>	/* for CHAR_BIT */
347c478bd9Sstevel@tonic-gate #include <time.h>
357c478bd9Sstevel@tonic-gate #include <stdlib.h>
367c478bd9Sstevel@tonic-gate #include <libintl.h>	/* for F_OK and R_OK */
377c478bd9Sstevel@tonic-gate #include <unistd.h>
3880868c53Srobbin #include <sys/wait.h>
397c478bd9Sstevel@tonic-gate 
4080868c53Srobbin /* static char	privatehid[] = "@(#)private.h	7.55"; */
4180868c53Srobbin 
4280868c53Srobbin #define	GRANDPARENTED	"Local time zone must be set--see zic manual page"
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate /* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX.  */
457c478bd9Sstevel@tonic-gate #define	is_digit(c)		((unsigned)(c) - '0' <= 9)
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate /*
487c478bd9Sstevel@tonic-gate  * Private function declarations.
497c478bd9Sstevel@tonic-gate  */
5080868c53Srobbin char 	*icatalloc(char *old, const char *new);
5180868c53Srobbin char 	*icpyalloc(const char *string);
527c478bd9Sstevel@tonic-gate char 	*imalloc(int n);
5380868c53Srobbin void 	*irealloc(void *pointer, int size);
5480868c53Srobbin void	ifree(char *pointer);
55*f430f59aSrobbin const char	*scheck(const char *string, const char *format);
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate /*
587c478bd9Sstevel@tonic-gate  * Finally, some convenience items.
597c478bd9Sstevel@tonic-gate  */
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate #ifndef TRUE
627c478bd9Sstevel@tonic-gate #define	TRUE	1
637c478bd9Sstevel@tonic-gate #endif /* !defined TRUE */
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate #ifndef FALSE
667c478bd9Sstevel@tonic-gate #define	FALSE	0
677c478bd9Sstevel@tonic-gate #endif /* !defined FALSE */
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate #ifndef TYPE_BIT
707c478bd9Sstevel@tonic-gate #define	TYPE_BIT(type)	(sizeof (type) * CHAR_BIT)
717c478bd9Sstevel@tonic-gate #endif /* !defined TYPE_BIT */
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate #ifndef TYPE_SIGNED
747c478bd9Sstevel@tonic-gate #define	TYPE_SIGNED(type) (((type) -1) < 0)
757c478bd9Sstevel@tonic-gate #endif /* !defined TYPE_SIGNED */
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate /*
787c478bd9Sstevel@tonic-gate  * INITIALIZE(x)
797c478bd9Sstevel@tonic-gate  */
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate #ifndef INITIALIZE
827c478bd9Sstevel@tonic-gate #ifdef lint
837c478bd9Sstevel@tonic-gate #define	INITIALIZE(x)	((x) = 0)
847c478bd9Sstevel@tonic-gate #endif /* defined lint */
857c478bd9Sstevel@tonic-gate #ifndef lint
867c478bd9Sstevel@tonic-gate #define	INITIALIZE(x)
877c478bd9Sstevel@tonic-gate #endif /* !defined lint */
887c478bd9Sstevel@tonic-gate #endif /* !defined INITIALIZE */
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
917c478bd9Sstevel@tonic-gate }
927c478bd9Sstevel@tonic-gate #endif
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate #endif	/* _PRIVATE_H */
95