Home | History | Annotate | Line # | Download | only in time
private.h revision 1.1
      1 #ifndef PRIVATE_H
      2 
      3 #define PRIVATE_H
      4 
      5 /*
      6 ** This header is for use ONLY with the time conversion code.
      7 ** There is no guarantee that it will remain unchanged,
      8 ** or that it will remain at all.
      9 ** Do NOT copy it to any system include directory.
     10 ** Thank you!
     11 */
     12 
     13 /*
     14 ** ID
     15 */
     16 
     17 #ifndef lint
     18 #ifndef NOID
     19 static char	privatehid[] = "@(#)private.h	7.33";
     20 #endif /* !defined NOID */
     21 #endif /* !defined lint */
     22 
     23 /*
     24 ** Defaults for preprocessor symbols.
     25 ** You can override these in your C compiler options, e.g. `-DHAVE_ADJTIME=0'.
     26 */
     27 
     28 #ifndef HAVE_ADJTIME
     29 #define HAVE_ADJTIME		1
     30 #endif /* !defined HAVE_ADJTIME */
     31 
     32 #ifndef HAVE_SETTIMEOFDAY
     33 #define HAVE_SETTIMEOFDAY	3
     34 #endif /* !defined HAVE_SETTIMEOFDAY */
     35 
     36 #ifndef HAVE_UNISTD_H
     37 #define HAVE_UNISTD_H		1
     38 #endif /* !defined HAVE_UNISTD_H */
     39 
     40 #ifndef LOCALE_HOME
     41 #define LOCALE_HOME		"/usr/lib/locale"
     42 #endif /* !defined LOCALE_HOME */
     43 
     44 /*
     45 ** Nested includes
     46 */
     47 
     48 #include "sys/types.h"	/* for time_t */
     49 #include "stdio.h"
     50 #include "ctype.h"
     51 #include "errno.h"
     52 #include "string.h"
     53 #include "limits.h"	/* for CHAR_BIT */
     54 #include "time.h"
     55 #include "stdlib.h"
     56 
     57 #if HAVE_UNISTD_H - 0
     58 #include "unistd.h"	/* for F_OK and R_OK */
     59 #endif /* HAVE_UNISTD_H - 0 */
     60 
     61 #if !(HAVE_UNISTD_H - 0)
     62 #ifndef F_OK
     63 #define F_OK	0
     64 #endif /* !defined F_OK */
     65 #ifndef R_OK
     66 #define R_OK	4
     67 #endif /* !defined R_OK */
     68 #endif /* !(HAVE_UNISTD_H - 0) */
     69 
     70 /*
     71 ** Workarounds for compilers/systems.
     72 */
     73 
     74 /*
     75 ** SunOS 4.1.1 cc lacks const.
     76 */
     77 
     78 #ifndef const
     79 #ifndef __STDC__
     80 #define const
     81 #endif /* !defined __STDC__ */
     82 #endif /* !defined const */
     83 
     84 /*
     85 ** SunOS 4.1.1 cc lacks prototypes.
     86 */
     87 
     88 #ifndef P
     89 #ifdef __STDC__
     90 #define P(x)	x
     91 #endif /* defined __STDC__ */
     92 #ifndef __STDC__
     93 #define P(x)	()
     94 #endif /* !defined __STDC__ */
     95 #endif /* !defined P */
     96 
     97 /*
     98 ** SunOS 4.1.1 headers lack EXIT_SUCCESS.
     99 */
    100 
    101 #ifndef EXIT_SUCCESS
    102 #define EXIT_SUCCESS	0
    103 #endif /* !defined EXIT_SUCCESS */
    104 
    105 /*
    106 ** SunOS 4.1.1 headers lack EXIT_FAILURE.
    107 */
    108 
    109 #ifndef EXIT_FAILURE
    110 #define EXIT_FAILURE	1
    111 #endif /* !defined EXIT_FAILURE */
    112 
    113 /*
    114 ** SunOS 4.1.1 headers lack FILENAME_MAX.
    115 */
    116 
    117 #ifndef FILENAME_MAX
    118 
    119 #ifndef MAXPATHLEN
    120 #ifdef unix
    121 #include "sys/param.h"
    122 #endif /* defined unix */
    123 #endif /* !defined MAXPATHLEN */
    124 
    125 #ifdef MAXPATHLEN
    126 #define FILENAME_MAX	MAXPATHLEN
    127 #endif /* defined MAXPATHLEN */
    128 #ifndef MAXPATHLEN
    129 #define FILENAME_MAX	1024		/* Pure guesswork */
    130 #endif /* !defined MAXPATHLEN */
    131 
    132 #endif /* !defined FILENAME_MAX */
    133 
    134 /*
    135 ** SunOS 4.1.1 libraries lack remove.
    136 */
    137 
    138 #ifndef remove
    139 extern int	unlink P((const char * filename));
    140 #define remove	unlink
    141 #endif /* !defined remove */
    142 
    143 /*
    144 ** Finally, some convenience items.
    145 */
    146 
    147 #ifndef TRUE
    148 #define TRUE	1
    149 #endif /* !defined TRUE */
    150 
    151 #ifndef FALSE
    152 #define FALSE	0
    153 #endif /* !defined FALSE */
    154 
    155 #ifndef INT_STRLEN_MAXIMUM
    156 /*
    157 ** 302 / 1000 is log10(2.0) rounded up.
    158 ** Subtract one for the sign bit;
    159 ** add one for integer division truncation;
    160 ** add one more for a minus sign.
    161 */
    162 #define INT_STRLEN_MAXIMUM(type) \
    163 	((sizeof(type) * CHAR_BIT - 1) * 302 / 1000 + 2)
    164 #endif /* !defined INT_STRLEN_MAXIMUM */
    165 
    166 /*
    167 ** INITIALIZE(x)
    168 */
    169 
    170 #ifndef GNUC_or_lint
    171 #ifdef lint
    172 #define GNUC_or_lint
    173 #endif /* defined lint */
    174 #ifndef lint
    175 #ifdef __GNUC__
    176 #define GNUC_or_lint
    177 #endif /* defined __GNUC__ */
    178 #endif /* !defined lint */
    179 #endif /* !defined GNUC_or_lint */
    180 
    181 #ifndef INITIALIZE
    182 #ifdef GNUC_or_lint
    183 #define INITIALIZE(x)	((x) = 0)
    184 #endif /* defined GNUC_or_lint */
    185 #ifndef GNUC_or_lint
    186 #define INITIALIZE(x)
    187 #endif /* !defined GNUC_or_lint */
    188 #endif /* !defined INITIALIZE */
    189 
    190 /*
    191 ** UNIX was a registered trademark of UNIX System Laboratories in 1993.
    192 */
    193 
    194 #endif /* !defined PRIVATE_H */
    195