diff options
Diffstat (limited to 'lib/libc/stdtime/private.h')
-rw-r--r-- | lib/libc/stdtime/private.h | 108 |
1 files changed, 62 insertions, 46 deletions
diff --git a/lib/libc/stdtime/private.h b/lib/libc/stdtime/private.h index 83d76f1..d8fa906 100644 --- a/lib/libc/stdtime/private.h +++ b/lib/libc/stdtime/private.h @@ -1,8 +1,10 @@ - - #ifndef PRIVATE_H #define PRIVATE_H +/* +** This file is in the public domain, so clarified as of +** June 5, 1996 by Arthur David Olson (arthur_david_olson@nih.gov). +*/ /* Stuff moved from Makefile.inc to reduce clutter */ #ifndef TM_GMTOFF @@ -11,6 +13,9 @@ #define STD_INSPIRED 1 #define PCTS 1 #define HAVE_LONG_DOUBLE 1 +#define HAVE_STRERROR 1 +#define HAVE_UNISTD_H 1 +#define LOCALE_HOME _PATH_LOCALE #define TZDIR "/usr/share/zoneinfo" #endif /* ndef TM_GMTOFF */ @@ -28,7 +33,9 @@ #ifndef lint #ifndef NOID -/*static char privatehid[] = "@(#)private.h 7.33";*/ +/* +static char privatehid[] = "@(#)private.h 7.43"; +*/ #endif /* !defined NOID */ #endif /* !defined lint */ @@ -41,27 +48,46 @@ #define HAVE_ADJTIME 1 #endif /* !defined HAVE_ADJTIME */ +#ifndef HAVE_GETTEXT +#define HAVE_GETTEXT 0 +#endif /* !defined HAVE_GETTEXT */ + #ifndef HAVE_SETTIMEOFDAY #define HAVE_SETTIMEOFDAY 3 #endif /* !defined HAVE_SETTIMEOFDAY */ +#ifndef HAVE_STRERROR +#define HAVE_STRERROR 0 +#endif /* !defined HAVE_STRERROR */ + #ifndef HAVE_UNISTD_H #define HAVE_UNISTD_H 1 #endif /* !defined HAVE_UNISTD_H */ +#ifndef HAVE_UTMPX_H +#define HAVE_UTMPX_H 0 +#endif /* !defined HAVE_UTMPX_H */ + +#ifndef LOCALE_HOME +#define LOCALE_HOME "/usr/lib/locale" +#endif /* !defined LOCALE_HOME */ + /* ** Nested includes */ #include "sys/types.h" /* for time_t */ #include "stdio.h" -#include "ctype.h" #include "errno.h" #include "string.h" #include "limits.h" /* for CHAR_BIT */ #include "time.h" #include "stdlib.h" +#if HAVE_GETTEXT - 0 +#include "libintl.h" +#endif /* HAVE_GETTEXT - 0 */ + #if HAVE_UNISTD_H - 0 #include "unistd.h" /* for F_OK and R_OK */ #endif /* HAVE_UNISTD_H - 0 */ @@ -75,22 +101,11 @@ #endif /* !defined R_OK */ #endif /* !(HAVE_UNISTD_H - 0) */ -/* -** Workarounds for compilers/systems. -*/ - -/* -** SunOS 4.1.1 cc lacks const. -*/ - -#ifndef const -#ifndef __STDC__ -#define const -#endif /* !defined __STDC__ */ -#endif /* !defined const */ +/* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */ +#define is_digit(c) ((unsigned)(c) - '0' <= 9) /* -** SunOS 4.1.1 cc lacks prototypes. +** Workarounds for compilers/systems. */ #ifndef P @@ -103,22 +118,6 @@ #endif /* !defined P */ /* -** SunOS 4.1.1 headers lack EXIT_SUCCESS. -*/ - -#ifndef EXIT_SUCCESS -#define EXIT_SUCCESS 0 -#endif /* !defined EXIT_SUCCESS */ - -/* -** SunOS 4.1.1 headers lack EXIT_FAILURE. -*/ - -#ifndef EXIT_FAILURE -#define EXIT_FAILURE 1 -#endif /* !defined EXIT_FAILURE */ - -/* ** SunOS 4.1.1 headers lack FILENAME_MAX. */ @@ -140,15 +139,6 @@ #endif /* !defined FILENAME_MAX */ /* -** SunOS 4.1.1 libraries lack remove. -*/ - -#ifndef remove -extern int unlink P((const char * filename)); -#define remove unlink -#endif /* !defined remove */ - -/* ** Finally, some convenience items. */ @@ -160,15 +150,23 @@ extern int unlink P((const char * filename)); #define FALSE 0 #endif /* !defined FALSE */ +#ifndef TYPE_BIT +#define TYPE_BIT(type) (sizeof (type) * CHAR_BIT) +#endif /* !defined TYPE_BIT */ + +#ifndef TYPE_SIGNED +#define TYPE_SIGNED(type) (((type) -1) < 0) +#endif /* !defined TYPE_SIGNED */ + #ifndef INT_STRLEN_MAXIMUM /* ** 302 / 1000 is log10(2.0) rounded up. -** Subtract one for the sign bit; +** Subtract one for the sign bit if the type is signed; ** add one for integer division truncation; -** add one more for a minus sign. +** add one more for a minus sign if the type is signed. */ #define INT_STRLEN_MAXIMUM(type) \ - ((sizeof(type) * CHAR_BIT - 1) * 302 / 1000 + 2) + ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 100 + 1 + TYPE_SIGNED(type)) #endif /* !defined INT_STRLEN_MAXIMUM */ /* @@ -196,6 +194,24 @@ extern int unlink P((const char * filename)); #endif /* !defined INITIALIZE */ /* +** For the benefit of GNU folk... +** `_(MSGID)' uses the current locale's message library string for MSGID. +** The default is to use gettext if available, and use MSGID otherwise. +*/ + +#ifndef _ +#if HAVE_GETTEXT - 0 +#define _(msgid) gettext(msgid) +#else /* !(HAVE_GETTEXT - 0) */ +#define _(msgid) msgid +#endif /* !(HAVE_GETTEXT - 0) */ +#endif /* !defined _ */ + +#ifndef TZ_DOMAIN +#define TZ_DOMAIN "tz" +#endif /* !defined TZ_DOMAIN */ + +/* ** UNIX was a registered trademark of UNIX System Laboratories in 1993. */ |