private.h 4.6 KB

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