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