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