1 /* $NetBSD: private.h,v 1.4 1996/01/08 22:50:57 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.35"; 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 LOCALE_HOME 48 #define LOCALE_HOME "/usr/lib/locale" 49 #endif /* !defined LOCALE_HOME */ 50 51 /* 52 ** Nested includes 53 */ 54 55 #include "sys/types.h" /* for time_t */ 56 #include "stdio.h" 57 #include "errno.h" 58 #include "string.h" 59 #include "limits.h" /* for CHAR_BIT */ 60 #include "time.h" 61 #include "stdlib.h" 62 63 #if HAVE_UNISTD_H - 0 64 #include "unistd.h" /* for F_OK and R_OK */ 65 #endif /* HAVE_UNISTD_H - 0 */ 66 67 #if !(HAVE_UNISTD_H - 0) 68 #ifndef F_OK 69 #define F_OK 0 70 #endif /* !defined F_OK */ 71 #ifndef R_OK 72 #define R_OK 4 73 #endif /* !defined R_OK */ 74 #endif /* !(HAVE_UNISTD_H - 0) */ 75 76 /* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */ 77 #define is_digit(c) ((unsigned)(c) - '0' <= 9) 78 79 /* 80 ** Workarounds for compilers/systems. 81 */ 82 83 /* 84 ** SunOS 4.1.1 cc lacks const. 85 */ 86 87 #ifndef const 88 #ifndef __STDC__ 89 #define const 90 #endif /* !defined __STDC__ */ 91 #endif /* !defined const */ 92 93 /* 94 ** SunOS 4.1.1 cc lacks prototypes. 95 */ 96 97 #ifndef P 98 #ifdef __STDC__ 99 #define P(x) x 100 #endif /* defined __STDC__ */ 101 #ifndef __STDC__ 102 #define P(x) () 103 #endif /* !defined __STDC__ */ 104 #endif /* !defined P */ 105 106 /* 107 ** SunOS 4.1.1 headers lack EXIT_SUCCESS. 108 */ 109 110 #ifndef EXIT_SUCCESS 111 #define EXIT_SUCCESS 0 112 #endif /* !defined EXIT_SUCCESS */ 113 114 /* 115 ** SunOS 4.1.1 headers lack EXIT_FAILURE. 116 */ 117 118 #ifndef EXIT_FAILURE 119 #define EXIT_FAILURE 1 120 #endif /* !defined EXIT_FAILURE */ 121 122 /* 123 ** SunOS 4.1.1 headers lack FILENAME_MAX. 124 */ 125 126 #ifndef FILENAME_MAX 127 128 #ifndef MAXPATHLEN 129 #ifdef unix 130 #include "sys/param.h" 131 #endif /* defined unix */ 132 #endif /* !defined MAXPATHLEN */ 133 134 #ifdef MAXPATHLEN 135 #define FILENAME_MAX MAXPATHLEN 136 #endif /* defined MAXPATHLEN */ 137 #ifndef MAXPATHLEN 138 #define FILENAME_MAX 1024 /* Pure guesswork */ 139 #endif /* !defined MAXPATHLEN */ 140 141 #endif /* !defined FILENAME_MAX */ 142 143 /* 144 ** SunOS 4.1.1 libraries lack remove. 145 */ 146 147 #ifndef remove 148 extern int unlink P((const char * filename)); 149 #define remove unlink 150 #endif /* !defined remove */ 151 152 /* 153 ** Finally, some convenience items. 154 */ 155 156 #ifndef TRUE 157 #define TRUE 1 158 #endif /* !defined TRUE */ 159 160 #ifndef FALSE 161 #define FALSE 0 162 #endif /* !defined FALSE */ 163 164 #ifndef INT_STRLEN_MAXIMUM 165 /* 166 ** 302 / 1000 is log10(2.0) rounded up. 167 ** If type is signed: 168 ** subtract one for the sign bit; 169 ** add one for integer division truncation; 170 ** add one more for a minus sign. 171 ** If type is unsigned: 172 ** do not subtract one since there is no sign bit; 173 ** add one for integer division truncation; 174 ** do not add one more for a minus sign. 175 */ 176 #define INT_STRLEN_MAXIMUM(type) \ 177 ((((type) -1) < 0) ? \ 178 ((sizeof(type) * CHAR_BIT - 1) * 302 / 1000 + 2) : \ 179 ((sizeof(type) * CHAR_BIT) * 302 / 1000 + 1)) 180 #endif /* !defined INT_STRLEN_MAXIMUM */ 181 182 /* 183 ** INITIALIZE(x) 184 */ 185 186 #ifndef GNUC_or_lint 187 #ifdef lint 188 #define GNUC_or_lint 189 #endif /* defined lint */ 190 #ifndef lint 191 #ifdef __GNUC__ 192 #define GNUC_or_lint 193 #endif /* defined __GNUC__ */ 194 #endif /* !defined lint */ 195 #endif /* !defined GNUC_or_lint */ 196 197 #ifndef INITIALIZE 198 #ifdef GNUC_or_lint 199 #define INITIALIZE(x) ((x) = 0) 200 #endif /* defined GNUC_or_lint */ 201 #ifndef GNUC_or_lint 202 #define INITIALIZE(x) 203 #endif /* !defined GNUC_or_lint */ 204 #endif /* !defined INITIALIZE */ 205 206 /* 207 ** UNIX was a registered trademark of UNIX System Laboratories in 1993. 208 */ 209 210 #endif /* !defined PRIVATE_H */ 211