| 1 |
#ifndef PRIVATE_H |
| 2 |
|
| 3 |
#define PRIVATE_H |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
#ifndef lint |
| 23 |
#ifndef NOID |
| 24 |
static char __attribute__((unused)) privatehid[] = "@(#)private.h 8.3"; |
| 25 |
#endif |
| 26 |
#endif |
| 27 |
|
| 28 |
#define GRANDPARENTED "Local time zone must be set--see zic manual page" |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
#ifndef HAVE_ADJTIME |
| 36 |
#define HAVE_ADJTIME 1 |
| 37 |
#endif |
| 38 |
|
| 39 |
#ifndef HAVE_GETTEXT |
| 40 |
#define HAVE_GETTEXT 0 |
| 41 |
#endif |
| 42 |
|
| 43 |
#ifndef HAVE_INCOMPATIBLE_CTIME_R |
| 44 |
#define HAVE_INCOMPATIBLE_CTIME_R 0 |
| 45 |
#endif |
| 46 |
|
| 47 |
#ifndef HAVE_SETTIMEOFDAY |
| 48 |
#define HAVE_SETTIMEOFDAY 3 |
| 49 |
#endif |
| 50 |
|
| 51 |
#ifndef HAVE_STRERROR |
| 52 |
#define HAVE_STRERROR 1 |
| 53 |
#endif |
| 54 |
|
| 55 |
#ifndef HAVE_SYMLINK |
| 56 |
#define HAVE_SYMLINK 1 |
| 57 |
#endif |
| 58 |
|
| 59 |
#ifndef HAVE_SYS_STAT_H |
| 60 |
#define HAVE_SYS_STAT_H 1 |
| 61 |
#endif |
| 62 |
|
| 63 |
#ifndef HAVE_SYS_WAIT_H |
| 64 |
#define HAVE_SYS_WAIT_H 1 |
| 65 |
#endif |
| 66 |
|
| 67 |
#ifndef HAVE_UNISTD_H |
| 68 |
#define HAVE_UNISTD_H 1 |
| 69 |
#endif |
| 70 |
|
| 71 |
#ifndef HAVE_UTMPX_H |
| 72 |
#define HAVE_UTMPX_H 0 |
| 73 |
#endif |
| 74 |
|
| 75 |
#ifndef LOCALE_HOME |
| 76 |
#define LOCALE_HOME "/usr/lib/locale" |
| 77 |
#endif |
| 78 |
|
| 79 |
#if HAVE_INCOMPATIBLE_CTIME_R |
| 80 |
#define asctime_r _incompatible_asctime_r |
| 81 |
#define ctime_r _incompatible_ctime_r |
| 82 |
#endif |
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
#include "sys/types.h" |
| 89 |
#include "stdio.h" |
| 90 |
#include "errno.h" |
| 91 |
#include "string.h" |
| 92 |
#include "limits.h" |
| 93 |
#include "time.h" |
| 94 |
#include "stdlib.h" |
| 95 |
|
| 96 |
#if HAVE_GETTEXT |
| 97 |
#include "libintl.h" |
| 98 |
#endif |
| 99 |
|
| 100 |
#if HAVE_SYS_WAIT_H |
| 101 |
#include <sys/wait.h> |
| 102 |
#endif |
| 103 |
|
| 104 |
#ifndef WIFEXITED |
| 105 |
#define WIFEXITED(status) (((status) & 0xff) == 0) |
| 106 |
#endif |
| 107 |
#ifndef WEXITSTATUS |
| 108 |
#define WEXITSTATUS(status) (((status) >> 8) & 0xff) |
| 109 |
#endif |
| 110 |
|
| 111 |
#if HAVE_UNISTD_H |
| 112 |
#include "unistd.h" |
| 113 |
#endif |
| 114 |
|
| 115 |
#if !HAVE_UNISTD_H |
| 116 |
#ifndef F_OK |
| 117 |
#define F_OK 0 |
| 118 |
#endif |
| 119 |
#ifndef R_OK |
| 120 |
#define R_OK 4 |
| 121 |
#endif |
| 122 |
#endif |
| 123 |
|
| 124 |
|
| 125 |
#define is_digit(c) ((unsigned)(c) - '0' <= 9) |
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
#ifndef HAVE_STDINT_H |
| 134 |
#define HAVE_STDINT_H \ |
| 135 |
(199901 <= __STDC_VERSION__ || \ |
| 136 |
2 < (__GLIBC__ + (0 < __GLIBC_MINOR__))) |
| 137 |
#endif |
| 138 |
|
| 139 |
#if HAVE_STDINT_H |
| 140 |
#include "stdint.h" |
| 141 |
#endif |
| 142 |
|
| 143 |
#ifndef INT_FAST64_MAX |
| 144 |
|
| 145 |
#if defined LLONG_MAX || defined __LONG_LONG_MAX__ |
| 146 |
typedef long long int_fast64_t; |
| 147 |
#else |
| 148 |
#if (LONG_MAX >> 31) < 0xffffffff |
| 149 |
Please use a compiler that supports a 64-bit integer type (or wider); |
| 150 |
you may need to compile with "-DHAVE_STDINT_H". |
| 151 |
#endif |
| 152 |
typedef long int_fast64_t; |
| 153 |
#endif |
| 154 |
#endif |
| 155 |
|
| 156 |
#ifndef INT32_MAX |
| 157 |
#define INT32_MAX 0x7fffffff |
| 158 |
#endif |
| 159 |
#ifndef INT32_MIN |
| 160 |
#define INT32_MIN (-1 - INT32_MAX) |
| 161 |
#endif |
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
#ifndef P |
| 172 |
#define P(x) x |
| 173 |
#endif |
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
#ifndef EXIT_SUCCESS |
| 180 |
#define EXIT_SUCCESS 0 |
| 181 |
#endif |
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
#ifndef EXIT_FAILURE |
| 188 |
#define EXIT_FAILURE 1 |
| 189 |
#endif |
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
#ifndef FILENAME_MAX |
| 196 |
|
| 197 |
#ifndef MAXPATHLEN |
| 198 |
#ifdef unix |
| 199 |
#include "sys/param.h" |
| 200 |
#endif |
| 201 |
#endif |
| 202 |
|
| 203 |
#ifdef MAXPATHLEN |
| 204 |
#define FILENAME_MAX MAXPATHLEN |
| 205 |
#endif |
| 206 |
#ifndef MAXPATHLEN |
| 207 |
#define FILENAME_MAX 1024 |
| 208 |
#endif |
| 209 |
|
| 210 |
#endif |
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
#ifndef remove |
| 217 |
extern int unlink P((const char * filename)); |
| 218 |
#define remove unlink |
| 219 |
#endif |
| 220 |
|
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
#ifndef errno |
| 228 |
extern int errno; |
| 229 |
#endif |
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
char * icalloc P((int nelem, int elsize)); |
| 236 |
char * icatalloc P((char * old, const char * new)); |
| 237 |
char * icpyalloc P((const char * string)); |
| 238 |
char * imalloc P((int n)); |
| 239 |
void * irealloc P((void * pointer, int size)); |
| 240 |
void icfree P((char * pointer)); |
| 241 |
void ifree P((char * pointer)); |
| 242 |
const char * scheck P((const char * string, const char * format)); |
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
#ifndef TRUE |
| 249 |
#define TRUE 1 |
| 250 |
#endif |
| 251 |
|
| 252 |
#ifndef FALSE |
| 253 |
#define FALSE 0 |
| 254 |
#endif |
| 255 |
|
| 256 |
#ifndef TYPE_BIT |
| 257 |
#define TYPE_BIT(type) (sizeof (type) * CHAR_BIT) |
| 258 |
#endif |
| 259 |
|
| 260 |
#ifndef TYPE_SIGNED |
| 261 |
#define TYPE_SIGNED(type) (((type) -1) < 0) |
| 262 |
#endif |
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
#ifndef TYPE_INTEGRAL |
| 270 |
#define TYPE_INTEGRAL(type) (((type) 0.5) != 0.5) |
| 271 |
#endif |
| 272 |
|
| 273 |
#ifndef INT_STRLEN_MAXIMUM |
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
#define INT_STRLEN_MAXIMUM(type) \ |
| 281 |
((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + \ |
| 282 |
1 + TYPE_SIGNED(type)) |
| 283 |
#endif |
| 284 |
|
| 285 |
|
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
#ifndef GNUC_or_lint |
| 290 |
#ifdef lint |
| 291 |
#define GNUC_or_lint |
| 292 |
#endif |
| 293 |
#ifndef lint |
| 294 |
#ifdef __GNUC__ |
| 295 |
#define GNUC_or_lint |
| 296 |
#endif |
| 297 |
#endif |
| 298 |
#endif |
| 299 |
|
| 300 |
#ifndef INITIALIZE |
| 301 |
#ifdef GNUC_or_lint |
| 302 |
#define INITIALIZE(x) ((x) = 0) |
| 303 |
#endif |
| 304 |
#ifndef GNUC_or_lint |
| 305 |
#define INITIALIZE(x) |
| 306 |
#endif |
| 307 |
#endif |
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
|
| 315 |
#ifndef _ |
| 316 |
#if HAVE_GETTEXT |
| 317 |
#define _(msgid) gettext(msgid) |
| 318 |
#else |
| 319 |
#define _(msgid) msgid |
| 320 |
#endif |
| 321 |
#endif |
| 322 |
|
| 323 |
#ifndef TZ_DOMAIN |
| 324 |
#define TZ_DOMAIN "tz" |
| 325 |
#endif |
| 326 |
|
| 327 |
#if HAVE_INCOMPATIBLE_CTIME_R |
| 328 |
#undef asctime_r |
| 329 |
#undef ctime_r |
| 330 |
char *asctime_r P((struct tm const *, char *)); |
| 331 |
char *ctime_r P((time_t const *, char *)); |
| 332 |
#endif |
| 333 |
|
| 334 |
#ifndef YEARSPERREPEAT |
| 335 |
#define YEARSPERREPEAT 400 |
| 336 |
#endif |
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
|
| 341 |
|
| 342 |
#ifndef AVGSECSPERYEAR |
| 343 |
#define AVGSECSPERYEAR 31556952L |
| 344 |
#endif |
| 345 |
|
| 346 |
#ifndef SECSPERREPEAT |
| 347 |
#define SECSPERREPEAT ((int_fast64_t) YEARSPERREPEAT * (int_fast64_t) AVGSECSPERYEAR) |
| 348 |
#endif |
| 349 |
|
| 350 |
#ifndef SECSPERREPEAT_BITS |
| 351 |
#define SECSPERREPEAT_BITS 34 |
| 352 |
#endif |
| 353 |
|
| 354 |
|
| 355 |
|
| 356 |
|
| 357 |
|
| 358 |
#endif |