home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 3 / 3930 / config.h next >
Encoding:
C/C++ Source or Header  |  1991-08-29  |  4.8 KB  |  223 lines

  1. /* config.h -    Configuration and portability definitions
  2.  *
  3.  * Copyright (c) 1991 Tim Cook.
  4.  * Non-profit distribution allowed.  See README for details.
  5.  *
  6.  * $Header: config.h 1.3 91/08/21 $
  7.  */
  8.  
  9. #ifndef _CONFIG_H_
  10. #define _CONFIG_H_
  11.  
  12. /*
  13.  * Date orientation.  For those who prefer seeing the month before the
  14.  * day of the month in dates, define US_DATE_FORMAT.
  15.  */
  16.  
  17. /* #define US_DATE_FORMAT    /* */
  18.  
  19. /*
  20.  * DBM library.  If you have an NDBM-compatible library, define NDBM,
  21.  * otherwise, you will need DBM.  If you have a version of DBM that
  22.  * does not include the dbmclose(3) routine, define NO_DBMCLOSE.
  23.  */
  24.  
  25. #define NDBM            /* */
  26. /* #define NO_DBMCLOSE        /* */
  27.  
  28. /*
  29.  * Directory reading routines.  Check your man page for readdir(3) and
  30.  * define one of DIRENT, SYS_DIR or SYS_NDIR to denote where the
  31.  * necessary include file is.  If your readdir(3) returns a
  32.  * "struct direct" pointer, define DIRECT, otherwise it will be
  33.  * assumed that readdir(3) returns a "struct dirent" pointer.
  34.  */
  35.  
  36. #define SYS_DIR            /* to include <sys/dir.h> */
  37. /* #define SYS_NDIR        /* to include <sys/ndir.h> */
  38. /* #define DIRENT        /* to include <dirent.h> */
  39.  
  40. #define DIRECT            /* readdir(3) returns "struct direct *" */
  41.  
  42. /*
  43.  * Uid/gid types.  Define these to what is returned by getuid(2) and
  44.  * getgid(2) (check the man pages).
  45.  */
  46.  
  47. #define UID_T    int        /* */
  48. #define GID_T    int        /* */
  49.  
  50. /*
  51.  * Data alignment.  If your architecture requires particular data
  52.  * items to be aligned, you may need to define this (you will if you
  53.  * get a "bus error" when you attempt a "dl -t").  Define it to 2
  54.  * for word alignment or 4 for longword alignment.
  55.  */
  56.  
  57. #ifdef sparc
  58. #define ALIGN    4        /* Longword alignment */
  59. #endif
  60.  
  61. /* #define ALIGN    2    /* Word alignment */
  62.  
  63. /*
  64.  * strings.h/string.h.  If you have no <string.h> on your system,
  65.  * define STRINGS and <strings.h> will be included instead.
  66.  */
  67.  
  68. /* #define STRINGS        /* */
  69.  
  70. /*
  71.  * str(r)chr/(r)index.  If you have no str(r)chr(3) on your system, define
  72.  * INDEX and (r)index(3) will be used instead.
  73.  */
  74.  
  75. /* #define INDEX        /* */
  76.  
  77. /*
  78.  * memcpy/bcopy.  If you have no memcpy(3), but you do have bcopy(3),
  79.  * define BCOPY.
  80.  */
  81.  
  82. /* #define BCOPY        /* */
  83.  
  84. /*
  85.  * Void types.  If your compiler does not handle any of these types,
  86.  * define them to something it will handle.  The recognised types will
  87.  * be used if these macros are not defined.
  88.  */
  89.  
  90. /* #define VOID        int    /* replacement for "void" */
  91. /* #define VOID_PTR    char *    /* replacement for "void *" */
  92. /* #define VOID_PTR_PTR    char ** /* replacement for "void **" */
  93.  
  94. /*
  95.  * SYSV.  If you have a System-V or System-V-based system, define
  96.  * SYSV.  This will activate the following assumptions:
  97.  *
  98.  *    - Include <time.h> instead of <sys/time.h>.
  99.  *    - File names may not exceed 14 characters.
  100.  *    - No "d_namlen" field in DIRENT structure.
  101.  *    - Include <fcntl.h> to get O_CREAT, etc.
  102.  */
  103.  
  104. /* #define SYSV            /* */
  105.  
  106.  
  107. /************************************************
  108.  * NOTHING PAST HERE SHOULD NEED TO BE MODIFIED *
  109.  ************************************************/
  110.  
  111. #ifdef NDBM
  112.  
  113. # include <ndbm.h>
  114. # define DBM_fetch(db, key)    dbm_fetch (db, key)
  115. # define DBM_store(db, key, val) \
  116.      dbm_store(db, key, val, DBM_REPLACE)
  117. # define DBM_delete(db, key)    dbm_delete (db, key)
  118. # define DBM_firstkey(db)    dbm_firstkey (db)
  119. # define DBM_nextkey(db, key)    dbm_nextkey (db)
  120.  
  121. # define DBM_close(db)        if (! (db)) ; else dbm_close (db)
  122.  
  123. #else
  124.  
  125. # include <dbm.h>
  126. # define DBM_fetch(db, key)    fetch (key)
  127. # define DBM_store(db, key, val) \
  128.      store(key, val)
  129. # define DBM_delete(db, key)    dbm_delete (key)
  130. # define DBM_firstkey(db)    dbm_firstkey ()
  131. # define DBM_nextkey(db, key)    dbm_nextkey (key)
  132.  
  133. # ifdef NO_DBMCLOSE
  134. #  define DBM_close(db)
  135. # else
  136. #  define DBM_close(db)        dbmclose ()
  137. # endif
  138.  
  139. # ifdef NULL
  140. #  undef NULL        /* Aaaaaaarrrrgghhh! */
  141. # endif
  142. #endif
  143.  
  144. /* This will probably be needed by one of the next three */
  145. #include <sys/types.h>
  146.  
  147. #ifdef DIRENT
  148. # include <dirent.h>
  149. # undef DIRENT
  150. #else
  151. # ifdef SYS_DIR
  152. #  include <sys/dir.h>
  153. #  undef SYS_DIR
  154. # else
  155. #  ifdef SYS_NDIR
  156. #   include <sys/ndir.h>
  157. #   undef SYS_NDIR
  158. #  endif
  159. # endif
  160. #endif
  161.  
  162. #ifdef DIRECT
  163. # define DIRENT    struct direct
  164. # undef DIRECT
  165. #else
  166. # define DIRENT    struct dirent
  167. #endif
  168.  
  169. #ifdef ALIGN
  170. # if ALIGN == 1
  171. #  undef ALIGN
  172. # endif
  173. #endif
  174.  
  175. #ifdef STRINGS
  176. # include <strings.h>
  177. # undef STRINGS
  178. #else
  179. # include <string.h>
  180. #endif
  181.  
  182. #ifdef INDEX
  183. # define strchr        index
  184. # define strrchr    rindex
  185. # undef INDEX
  186. #endif
  187.  
  188. #ifdef BCOPY
  189. # define memcpy(d,s,c)    bcopy(s,d,c)
  190. # undef BCOPY
  191. #endif
  192.  
  193. #ifndef    VOID
  194. # define VOID        void
  195. #endif
  196. #ifndef VOID_PTR
  197. # define VOID_PTR    void *
  198. #endif
  199. #ifndef VOID_PTR_PTR
  200. # define VOID_PTR_PTR    void **
  201. #endif
  202.  
  203. /* Miscellaneous */
  204. #ifndef TRUE
  205. #define TRUE        1
  206. #define FALSE        0
  207. #endif
  208.  
  209. #ifndef EOS
  210. #define EOS        '\0'
  211. #endif
  212.  
  213. #ifndef NULL_CP
  214. #define    NULL_CP        ((char *) 0)
  215. #endif
  216.  
  217. #ifndef print
  218. #define print(s)    fputs (s, stdout)
  219. #define printc(c)    putc (c, stdout)
  220. #endif
  221.  
  222. #endif    /* _CONFIG_H_ */
  223.