private.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. /* $FreeBSD: src/lib/libc/stdtime/private.h,v 1.6.8.1 2000/08/23 00:19:15 jhb Exp $ */
  2. #ifndef PRIVATE_H
  3. #define PRIVATE_H
  4. /*
  5. ** This file is in the public domain, so clarified as of
  6. ** June 5, 1996 by Arthur David Olson (arthur_david_olson@nih.gov).
  7. */
  8. /* Stuff moved from Makefile.inc to reduce clutter */
  9. #ifndef TM_GMTOFF
  10. #define TM_GMTOFF tm_gmtoff
  11. #define TM_ZONE tm_zone
  12. #define STD_INSPIRED 1
  13. #define PCTS 1
  14. #define HAVE_LONG_DOUBLE 1
  15. #define HAVE_STRERROR 1
  16. #define HAVE_UNISTD_H 1
  17. #define LOCALE_HOME _PATH_LOCALE
  18. #define TZDIR "/usr/share/zoneinfo"
  19. #endif /* ndef TM_GMTOFF */
  20. /*
  21. ** This header is for use ONLY with the time conversion code.
  22. ** There is no guarantee that it will remain unchanged,
  23. ** or that it will remain at all.
  24. ** Do NOT copy it to any system include directory.
  25. ** Thank you!
  26. */
  27. /*
  28. ** ID
  29. */
  30. #ifndef lint
  31. #ifndef NOID
  32. /*
  33. static char privatehid[] = "@(#)private.h 7.43";
  34. */
  35. #endif /* !defined NOID */
  36. #endif /* !defined lint */
  37. /*
  38. ** Defaults for preprocessor symbols.
  39. ** You can override these in your C compiler options, e.g. `-DHAVE_ADJTIME=0'.
  40. */
  41. #ifndef HAVE_ADJTIME
  42. #define HAVE_ADJTIME 1
  43. #endif /* !defined HAVE_ADJTIME */
  44. #ifndef HAVE_GETTEXT
  45. #define HAVE_GETTEXT 0
  46. #endif /* !defined HAVE_GETTEXT */
  47. #ifndef HAVE_SETTIMEOFDAY
  48. #define HAVE_SETTIMEOFDAY 3
  49. #endif /* !defined HAVE_SETTIMEOFDAY */
  50. #ifndef HAVE_STRERROR
  51. #define HAVE_STRERROR 0
  52. #endif /* !defined HAVE_STRERROR */
  53. #ifndef HAVE_UNISTD_H
  54. #define HAVE_UNISTD_H 1
  55. #endif /* !defined HAVE_UNISTD_H */
  56. #ifndef HAVE_UTMPX_H
  57. #define HAVE_UTMPX_H 0
  58. #endif /* !defined HAVE_UTMPX_H */
  59. #ifndef LOCALE_HOME
  60. #define LOCALE_HOME "/usr/lib/locale"
  61. #endif /* !defined LOCALE_HOME */
  62. /*
  63. ** Nested includes
  64. */
  65. #include "sys/types.h" /* for time_t */
  66. #include "stdio.h"
  67. #include "errno.h"
  68. #include "string.h"
  69. #include "limits.h" /* for CHAR_BIT */
  70. #include "time.h"
  71. #include "stdlib.h"
  72. #if HAVE_GETTEXT - 0
  73. #include "libintl.h"
  74. #endif /* HAVE_GETTEXT - 0 */
  75. #if HAVE_UNISTD_H - 0
  76. #include "unistd.h" /* for F_OK and R_OK */
  77. #endif /* HAVE_UNISTD_H - 0 */
  78. #if !(HAVE_UNISTD_H - 0)
  79. #ifndef F_OK
  80. #define F_OK 0
  81. #endif /* !defined F_OK */
  82. #ifndef R_OK
  83. #define R_OK 4
  84. #endif /* !defined R_OK */
  85. #endif /* !(HAVE_UNISTD_H - 0) */
  86. /* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */
  87. #define is_digit(c) ((unsigned)(c) - '0' <= 9)
  88. /*
  89. ** Workarounds for compilers/systems.
  90. */
  91. #ifndef P
  92. #ifdef __STDC__
  93. #define P(x) x
  94. #endif /* defined __STDC__ */
  95. #ifndef __STDC__
  96. #define P(x) ()
  97. #endif /* !defined __STDC__ */
  98. #endif /* !defined P */
  99. /*
  100. ** SunOS 4.1.1 headers lack FILENAME_MAX.
  101. */
  102. #ifndef FILENAME_MAX
  103. #ifndef MAXPATHLEN
  104. #ifdef unix
  105. #include "sys/param.h"
  106. #endif /* defined unix */
  107. #endif /* !defined MAXPATHLEN */
  108. #ifdef MAXPATHLEN
  109. #define FILENAME_MAX MAXPATHLEN
  110. #endif /* defined MAXPATHLEN */
  111. #ifndef MAXPATHLEN
  112. #define FILENAME_MAX 1024 /* Pure guesswork */
  113. #endif /* !defined MAXPATHLEN */
  114. #endif /* !defined FILENAME_MAX */
  115. /*
  116. ** Finally, some convenience items.
  117. */
  118. #ifndef TRUE
  119. #define TRUE 1
  120. #endif /* !defined TRUE */
  121. #ifndef FALSE
  122. #define FALSE 0
  123. #endif /* !defined FALSE */
  124. #ifndef TYPE_BIT
  125. #define TYPE_BIT(type) (sizeof (type) * CHAR_BIT)
  126. #endif /* !defined TYPE_BIT */
  127. #ifndef TYPE_SIGNED
  128. #define TYPE_SIGNED(type) (((type) -1) < 0)
  129. #endif /* !defined TYPE_SIGNED */
  130. #ifndef INT_STRLEN_MAXIMUM
  131. /*
  132. ** 302 / 1000 is log10(2.0) rounded up.
  133. ** Subtract one for the sign bit if the type is signed;
  134. ** add one for integer division truncation;
  135. ** add one more for a minus sign if the type is signed.
  136. */
  137. #define INT_STRLEN_MAXIMUM(type) \
  138. ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + 1 + TYPE_SIGNED(type))
  139. #endif /* !defined INT_STRLEN_MAXIMUM */
  140. /*
  141. ** INITIALIZE(x)
  142. */
  143. #ifndef GNUC_or_lint
  144. #ifdef lint
  145. #define GNUC_or_lint
  146. #endif /* defined lint */
  147. #ifndef lint
  148. #ifdef __GNUC__
  149. #define GNUC_or_lint
  150. #endif /* defined __GNUC__ */
  151. #endif /* !defined lint */
  152. #endif /* !defined GNUC_or_lint */
  153. #ifndef INITIALIZE
  154. #ifdef GNUC_or_lint
  155. #define INITIALIZE(x) ((x) = 0)
  156. #endif /* defined GNUC_or_lint */
  157. #ifndef GNUC_or_lint
  158. #define INITIALIZE(x)
  159. #endif /* !defined GNUC_or_lint */
  160. #endif /* !defined INITIALIZE */
  161. /*
  162. ** For the benefit of GNU folk...
  163. ** `_(MSGID)' uses the current locale's message library string for MSGID.
  164. ** The default is to use gettext if available, and use MSGID otherwise.
  165. */
  166. #ifndef _
  167. #if HAVE_GETTEXT - 0
  168. #define _(msgid) gettext(msgid)
  169. #else /* !(HAVE_GETTEXT - 0) */
  170. #define _(msgid) msgid
  171. #endif /* !(HAVE_GETTEXT - 0) */
  172. #endif /* !defined _ */
  173. #ifndef TZ_DOMAIN
  174. #define TZ_DOMAIN "tz"
  175. #endif /* !defined TZ_DOMAIN */
  176. /*
  177. ** UNIX was a registered trademark of UNIX System Laboratories in 1993.
  178. */
  179. #endif /* !defined PRIVATE_H */