home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / dev / lang / sgmls / src / std.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-10  |  2.3 KB  |  111 lines

  1. /* std.h -
  2.    Include standard header files.
  3. */
  4.  
  5. #ifndef STD_H
  6. #define STD_H 1
  7.  
  8. #include <stdio.h>
  9. #include <ctype.h>
  10. #include <errno.h>
  11. #include <assert.h>
  12. #ifdef SUPPORT_SUBDOC
  13. #include <signal.h>
  14. #endif /* SUPPORT_SUBDOC */
  15.  
  16. #ifndef STDDEF_H_MISSING
  17. #include <stddef.h>
  18. #endif /* not STDDEF_H_MISSING */
  19.  
  20. #ifndef LIMITS_H_MISSING
  21. #include <limits.h>
  22. #endif /* not LIMITS_H_MISSING */
  23.  
  24. #ifndef UINT_MAX
  25. #define UINT_MAX (sizeof(unsigned int) == 2 ? 0x7fff : \
  26.   (sizeof(unsigned int) == 4 ? 0x7fffffff : cant_guess_UINT_MAX))
  27. #endif
  28.  
  29. #ifdef VARARGS
  30. #include <varargs.h>
  31. #else
  32. #include <stdarg.h>
  33. #endif
  34.  
  35. #ifdef BSD_STRINGS
  36. #include <strings.h>
  37. #define memcpy(to, from, n) bcopy(from, to, n)
  38. #define memcmp(p, q, n) bcmp(p, q, n)
  39. #define strchr(s, c) index(s, c)
  40. #define strrchr(s, c) rindex(s, c)
  41. #else /* not BSD_STRINGS */
  42. #include <string.h>
  43. #endif /* not BSD_STRINGS */
  44.  
  45. extern char *strerror();
  46.  
  47. #ifdef STDLIB_H_MISSING
  48. UNIV malloc();
  49. UNIV calloc();
  50. UNIV realloc();
  51. char *getenv();
  52. long atol();
  53. #else /* not STDLIB_H_MISSING */
  54. #include <stdlib.h>
  55. #endif /* not STDLIB_H_MISSING */
  56.  
  57. #ifdef REMOVE_MISSING
  58. #ifdef HAVE_UNISTD_H
  59. #include <unistd.h>
  60. #endif /* HAVE_UNISTD_H */
  61. #define remove unlink
  62. #endif /* REMOVE_MISSING */
  63.  
  64. #ifdef RAISE_MISSING
  65. #ifdef HAVE_UNISTD_H
  66. #include <unistd.h>
  67. #endif /* HAVE_UNISTD_H */
  68. #define raise(sig) kill(getpid(), sig)
  69. #endif /* RAISE_MISSING */
  70.  
  71. #ifndef offsetof
  72. #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
  73. #endif
  74.  
  75. #ifndef EXIT_FAILURE
  76. #define EXIT_FAILURE 1
  77. #endif
  78. #ifndef EXIT_SUCCESS
  79. #define EXIT_SUCCESS 0
  80. #endif
  81.  
  82. #ifndef SEEK_SET
  83. #define SEEK_SET 0
  84. #define SEEK_CUR 1
  85. #define SEEK_END 2
  86. #endif
  87.  
  88. #ifdef FPOS_MISSING
  89. typedef long fpos_t;
  90. #define fsetpos(stream, pos) fseek(stream, *(pos), SEEK_SET)
  91. #define fgetpos(stream, pos) ((*(pos) = ftell(stream)) == -1L)
  92. #endif /* FPOS_MISSING */
  93.  
  94. /* Old BSD systems lack L_tmpnam and tmpnam().  This is a partial
  95. emulation using mktemp().  It requires that the argument to tmpnam()
  96. be non-NULL. */
  97.  
  98. #ifndef L_tmpnam
  99. #define tmpnam_template "/tmp/sgmlsXXXXXX"
  100. #define L_tmpnam (sizeof(tmpnam_template))
  101. #undef tmpnam
  102. #define tmpnam(buf) \
  103.   (mktemp(strcpy(buf, tmpnam_template)) == 0 || (buf)[0] == '\0' ? 0 : (buf))
  104. #endif /* not L_tmpnam */
  105.  
  106. #ifndef errno
  107. extern int errno;
  108. #endif
  109.  
  110. #endif /* not STD_H */
  111.