1 /*! 2 @file private.h 3 @brief This file is from the tz distribution at ftp://elsie.nci.nih.gov/pub/ 4 @version $Rev: 1358 $ 5 */ 6 #ifndef PRIVATE_H 7 8 #define PRIVATE_H 9 10 /* 11 ** This file is in the public domain, so clarified as of 12 ** 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov). 13 */ 14 15 /* 16 ** This header is for use ONLY with the time conversion code. 17 ** There is no guarantee that it will remain unchanged, 18 ** or that it will remain at all. 19 ** Do NOT copy it to any system include directory. 20 ** Thank you! 21 */ 22 23 /* 24 ** ID 25 */ 26 27 #ifndef lint 28 #ifndef NOID 29 static char privatehid[] = "@(#)private.h 7.53"; 30 #endif /* !defined NOID */ 31 #endif /* !defined lint */ 32 33 /* ahu: moved required preprocessor symbols to config.h */ 34 35 /* ahu: disable warnings */ 36 #ifdef _MSC_VER 37 // disable warning 'uses old-style declarator' C4131 38 #pragma warning (disable: 4131) 39 #endif 40 41 /* 42 ** Nested includes 43 */ 44 45 #include "sys/types.h" /* for time_t */ 46 #include "stdio.h" 47 #include "errno.h" 48 #include "string.h" 49 #include "limits.h" /* for CHAR_BIT */ 50 #include "time.h" 51 #include "stdlib.h" 52 53 /* ahu: added io.h for MSVC */ 54 #ifdef _MSC_VER 55 # include "io.h" 56 #endif 57 58 /* ahu: deleted include libintl.h */ 59 60 /* ahu: deleted include sys/wait.h and WIFEXITED, WEXITSTATUS macros */ 61 62 #if EXV_HAVE_UNISTD_H - 0 63 #include "unistd.h" /* for F_OK and R_OK */ 64 #endif /* EXV_HAVE_UNISTD_H - 0 */ 65 66 #if !(EXV_HAVE_UNISTD_H - 0) 67 #ifndef F_OK 68 #define F_OK 0 69 #endif /* !defined F_OK */ 70 #ifndef R_OK 71 #define R_OK 4 72 #endif /* !defined R_OK */ 73 #endif /* !(EXV_HAVE_UNISTD_H - 0) */ 74 75 /* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */ 76 #define is_digit(c) ((unsigned)(c) - '0' <= 9) 77 78 /* 79 ** Workarounds for compilers/systems. 80 */ 81 82 /* 83 ** SunOS 4.1.1 cc lacks prototypes. 84 */ 85 86 #ifndef P 87 #ifdef __STDC__ 88 #define P(x) x 89 #endif /* defined __STDC__ */ 90 #ifndef __STDC__ 91 #define P(x) () 92 #endif /* !defined __STDC__ */ 93 #endif /* !defined P */ 94 95 /* 96 ** SunOS 4.1.1 headers lack EXIT_SUCCESS. 97 */ 98 99 #ifndef EXIT_SUCCESS 100 #define EXIT_SUCCESS 0 101 #endif /* !defined EXIT_SUCCESS */ 102 103 /* 104 ** SunOS 4.1.1 headers lack EXIT_FAILURE. 105 */ 106 107 #ifndef EXIT_FAILURE 108 #define EXIT_FAILURE 1 109 #endif /* !defined EXIT_FAILURE */ 110 111 /* 112 ** SunOS 4.1.1 headers lack FILENAME_MAX. 113 */ 114 115 #ifndef FILENAME_MAX 116 117 #ifndef MAXPATHLEN 118 #ifdef unix 119 #include "sys/param.h" 120 #endif /* defined unix */ 121 #endif /* !defined MAXPATHLEN */ 122 123 #ifdef MAXPATHLEN 124 #define FILENAME_MAX MAXPATHLEN 125 #endif /* defined MAXPATHLEN */ 126 #ifndef MAXPATHLEN 127 #define FILENAME_MAX 1024 /* Pure guesswork */ 128 #endif /* !defined MAXPATHLEN */ 129 130 #endif /* !defined FILENAME_MAX */ 131 132 /* ahu: deleted unlink declaration and remove define */ 133 134 /* ahu: deleted errno declaration */ 135 136 /* ahu: deleted private function declarations */ 137 138 /* 139 ** Finally, some convenience items. 140 */ 141 142 #ifndef TRUE 143 #define TRUE 1 144 #endif /* !defined TRUE */ 145 146 #ifndef FALSE 147 #define FALSE 0 148 #endif /* !defined FALSE */ 149 150 #ifndef TYPE_BIT 151 #define TYPE_BIT(type) (sizeof (type) * CHAR_BIT) 152 #endif /* !defined TYPE_BIT */ 153 154 #ifndef TYPE_SIGNED 155 #define TYPE_SIGNED(type) (((type) -1) < 0) 156 #endif /* !defined TYPE_SIGNED */ 157 158 #ifndef INT_STRLEN_MAXIMUM 159 /* 160 ** 302 / 1000 is log10(2.0) rounded up. 161 ** Subtract one for the sign bit if the type is signed; 162 ** add one for integer division truncation; 163 ** add one more for a minus sign if the type is signed. 164 */ 165 #define INT_STRLEN_MAXIMUM(type) \ 166 ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + 1 + TYPE_SIGNED(type)) 167 #endif /* !defined INT_STRLEN_MAXIMUM */ 168 169 /* 170 ** INITIALIZE(x) 171 */ 172 173 #ifndef GNUC_or_lint 174 #ifdef lint 175 #define GNUC_or_lint 176 #endif /* defined lint */ 177 #ifndef lint 178 #ifdef __GNUC__ 179 #define GNUC_or_lint 180 #endif /* defined __GNUC__ */ 181 #endif /* !defined lint */ 182 #endif /* !defined GNUC_or_lint */ 183 184 #ifndef INITIALIZE 185 #ifdef GNUC_or_lint 186 #define INITIALIZE(x) ((x) = 0) 187 #endif /* defined GNUC_or_lint */ 188 #ifndef GNUC_or_lint 189 #define INITIALIZE(x) 190 #endif /* !defined GNUC_or_lint */ 191 #endif /* !defined INITIALIZE */ 192 193 /* ahu: deleted definition of _(msgid) macro */ 194 195 #ifndef TZ_DOMAIN 196 #define TZ_DOMAIN "tz" 197 #endif /* !defined TZ_DOMAIN */ 198 199 #if HAVE_INCOMPATIBLE_CTIME_R 200 #undef asctime_r 201 #undef ctime_r 202 char *asctime_r P((struct tm const *, char *)); 203 char *ctime_r P((time_t const *, char *)); 204 #endif /* HAVE_INCOMPATIBLE_CTIME_R */ 205 206 /* 207 ** UNIX was a registered trademark of The Open Group in 2003. 208 */ 209 210 #endif /* !defined PRIVATE_H */ 211