home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / mm / ccmd / ccmdlib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-18  |  4.0 KB  |  203 lines

  1. /*
  2.  Copyright (c) 1986, 1990 by The Trustees of Columbia University in
  3.  the City of New York.  Permission is granted to any individual or
  4.  institution to use, copy, or redistribute this software so long as it
  5.  is not sold for profit, provided this copyright notice is retained.
  6.  
  7. */
  8.  
  9. /*
  10.  * First look for files which can be included unconditionally on any
  11.  * UNIX variant.
  12.  */
  13.  
  14. #include <sys/types.h>
  15. #include <sys/param.h>
  16. #include <sys/ioctl.h>
  17. #include <sys/stat.h>
  18. #include <errno.h>
  19.  
  20. /*
  21.  * Make some initial assumptions.
  22.  *
  23.  * We should be able to configure ourself correctly if running under
  24.  * SunOS, 4.3BSD, HP-UX (s300 or s800), or on a Celerity (?).
  25.  *
  26.  * On 4.2bsd systems, compile with -DBSD
  27.  * On System V Release 3 systems, compile with -DSVR3
  28.  * On System V Release 2 systems, compile with -DSVR2
  29.  * On other System V systems, compile with -DSYSV
  30.  *
  31.  * On 4.1bsd, 32/V, System III, etc, some additional work
  32.  * will probably be necessary.
  33.  */
  34.  
  35. #if !defined(SYSV) && (SVR3 || SVR2)
  36. #define SYSV 1
  37. #endif
  38.  
  39. #if unix && !defined(BSD) && !defined(SYSV)
  40. #   if hpux || u3b || u3b2 || u3b5 || u3b15 || u3b20
  41. #    define SYSV 1
  42. #   else
  43. #   if defined(TIOCNOTTY) || sun || ultrix || accel
  44. #    define BSD 1
  45. #   endif
  46. #   endif /* !SYSV */
  47. #endif /* unix && ... */
  48.  
  49. /*
  50.  * Make a guess as to some os-dependent include files we'll need.
  51.  * These #define's can be overridden in site.h.
  52.  */
  53.  
  54. #if BSD
  55. #define needSYSTIME
  56. #define needFCNTL
  57. #undef  needUNISTD
  58. #define needSYSFILE
  59. #define STRINGS                /* index, rindex, etc */
  60. #define BSTRING                /* bzero, bcopy, etc */
  61. #endif /* BSD */
  62.  
  63. #if SYSV
  64. #define needTERMIO
  65. #define needFCNTL
  66. #define needUNISTD            /* you may need to override */
  67. #undef  needSYSFILE            /*  these two in site.h */
  68. #undef  STRINGS
  69. #undef  BSTRING
  70. #endif /* SYSV */
  71.  
  72. /*
  73.  * Next, include site-specific configuration information.
  74.  * 
  75.  */
  76.  
  77. #include "machdep.h"
  78.  
  79. /*
  80.  * Now include the rest of the header files and add any other appropriate
  81.  * definitions, based on what we know from the header files included so far.
  82.  */
  83.  
  84. #ifdef needSYSTIME
  85. #include <sys/time.h>
  86. #else
  87. #include <time.h>
  88. #endif
  89.  
  90. /*
  91.  * We need one or more of unistd.h, fcntl.h, and sys/file.h.
  92.  */
  93.  
  94. #ifdef needFCNTL
  95. #include <fcntl.h>
  96. #endif
  97. #ifdef needUNISTD
  98. #include <unistd.h>
  99. #endif
  100. #if !defined(O_RDONLY) || !defined(R_OK)
  101. #define needSYSFILE
  102. #endif
  103. #if !defined(SEEK_SET) && !defined(L_SET)
  104. #define needSYSFILE
  105. #endif
  106. #ifdef needSYSFILE
  107. #include <sys/file.h>
  108. #endif
  109. #if defined(L_SET) && !defined(SEEK_SET)
  110. #define SEEK_SET    L_SET
  111. #define SEEK_CUR    L_INCR
  112. #define SEEK_END    L_XTND
  113. #endif
  114.  
  115. /*
  116.  * tty driver definitions
  117.  */
  118. #ifdef needTERMIO
  119. #include <sys/termio.h>
  120. #else
  121. #include <sgtty.h>
  122. #endif
  123.  
  124. /*
  125.  * CCMD routines generally assume the presence of
  126.  * the Berkeley strings(3) and bstring(3) routines.
  127.  */
  128. #if !defined(STRINGS)
  129. #define index strchr
  130. #define rindex strrchr
  131. #endif
  132.  
  133. #if !defined(BSTRING)
  134. #define bzero(a,b)    memset((a),0,b)
  135. #define bcopy(a,b,c)    memcpy((b),(a),c)
  136. #define bcmp(a,b,c)    memcmp((a),(b),c)
  137. #endif
  138.  
  139. /*
  140.  * We need to define exactly one of DIRLIB, NDIRLIB, DIRENTLIB, or NODIRLIB.
  141.  */
  142.  
  143. #if !defined(DIRLIB) && !defined(NDIRLIB) && !defined(DIRENTLIB)
  144. #if !defined(NODIRLIB)
  145. #   if u3b || u3b2 || u3b5 || u3b15 || u3b20 || SVR3
  146. #    define DIRENTLIB
  147. #   else
  148. #   if hpux
  149. #    define NDIRLIB
  150. #   else
  151. #   if BSD
  152. #    define DIRLIB
  153. #   else
  154. #    define NODIRLIB
  155. #   endif /* !bsd */
  156. #   endif /* !hpux */
  157. #   endif /* !posix */
  158. #endif
  159. #endif
  160.  
  161. #ifdef DIRENTLIB
  162. #   include <dirent.h>
  163. #endif
  164. #ifdef NDIRLIB
  165. #   include <ndir.h>
  166. #endif
  167. #ifdef DIRLIB
  168. #   include <sys/dir.h>
  169. #endif
  170.  
  171. #ifdef NODIRLIB
  172. #   if MSDOS
  173. #    include <dos.h>
  174. #    include <direct.h>
  175. #   endif
  176. #endif
  177.  
  178. /*
  179.  * Miscellaneous other files we need.
  180.  */
  181.  
  182. #include <varargs.h>
  183. #include <signal.h>
  184. #include <ctype.h>
  185. #if unix
  186. #include <utmp.h>
  187. #endif
  188.  
  189. /*
  190.  * On some systems, signal handlers are defined as returning (void).
  191.  */
  192.  
  193. #ifndef SIGNALHANDLERTYPE
  194. #define SIGNALHANDLERTYPE int
  195. #endif
  196. typedef SIGNALHANDLERTYPE (*signal_handler_t) ();
  197.  
  198. /*
  199.  * Finally, include ccmd.h, which includes stdio.h and setjmp.h.
  200.  */
  201.  
  202. #include "ccmd.h"
  203.