home *** CD-ROM | disk | FTP | other *** search
/ back2roots/padua / padua.7z / padua / uucp / auucp+-1.02 / fuucp_news_src.lzh / cnews / include / news.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-11-21  |  5.0 KB  |  161 lines

  1. #ifndef _NEWS_H_
  2. #define _NEWS_H_
  3. /*
  4.  * definitions unique to all of C news
  5.  * things marked with qqq are subject to being configured by "build"
  6.  */
  7.  
  8. /*
  9.  * tunable parameters
  10.  * which actually very seldom need to be tuned
  11.  * in particular, don't get alarmed about MAXCOMP, it's not used for
  12.  *  anything where it matters
  13.  */
  14.  
  15. #define MAXPATH 1024        /* max. length of pwd output */
  16. #define MAXCOMP 14        /* file name component length */
  17. #define MAXHOST 128        /* max. length of this host's name */
  18. #define SPOOLTMP ".tmpXXXXXX"    /* template for NEWSARTS temporary link */
  19.  
  20. /* STATIC & FORWARD must agree to avoid redeclarations(!) */
  21. #define STATIC    static        /* "static" when not debugging|profiling */
  22.  
  23. /* adapt to compiler limitations */
  24. #ifdef pdp11
  25. # define FORWARD            /* "static" except for dmr's 11 compiler */
  26. #else
  27. # define FORWARD static        /* "static" except for dmr's 11 compiler */
  28. #endif
  29.  
  30. #if 0
  31. #define void int        /* if your compiler doesn't understand void's */
  32. #define MAXLONG 017777777777L
  33.                         /* if your compiler lacks "unsigned long" type */
  34. #endif
  35.  
  36. /* adapt to library limitations */
  37. /* #define NOSTOREVAL */
  38.         /* qqq if your dbm store() returns no value (as in orig. v7) */
  39.  
  40. /* fundamental constants of the implementation */
  41.  
  42. /* #define SMALLMEM 1    * qqq for PDP-11s, PDP-8s, IBM PCs, etc. */
  43. #define    FASTINDEX 1    /* qqq if string functions are very fast */
  44.  
  45. /* automatic configuration */
  46. #ifdef pdp11
  47. # ifndef SMALLMEM
  48. #  define SMALLMEM
  49. # endif                /* SMALLMEM */
  50. #endif                /* pdp11 */
  51.  
  52. /* types */
  53. typedef short statust;
  54. typedef char boolean;
  55.  
  56. /* status bits */
  57. #define ST_OKAY            0    /* nothing wrong */
  58. #define ST_SHORT    (1<<1)    /* art shorter than byte count; truncated? */
  59. #define ST_ACCESS    (1<<2)    /* no access permission */
  60. #define ST_REFUSED    (1<<3)    /* article was deliberately refused - OK */
  61. #define ST_DROPPED    (1<<4)    /* article was accidentally dropped */
  62. #define ST_DISKFULL    (1<<5)    /* disk full - give up */
  63. #define ST_JUNKED    (1<<6)    /* article was accepted, but junked */
  64.  
  65. /* newsgroup specific definitions */
  66. #define NGSEP        ','        /* separates groups */
  67. #define NGNEG        '!'        /* preceding a pattern, negates it */
  68. #define NGDELIM        '.'        /* within a group */
  69. #define FNDELIM        '/'        /* within a group, on disk */
  70. #define SFNDELIM    "/"        /* string of FNDELIM */
  71.  
  72. /* macros, replacing functions for speed */
  73. #define iswhite(c) ((c) == ' ' || (c) == '\t')
  74.  
  75. #ifndef max
  76. #define max(a,b) ((a) > (b)? (a): (b))
  77. #define min(a,b) ((a) < (b)? (a): (b))
  78. #endif
  79.  
  80. /* STREQ is an optimised strcmp(a,b)==0 */
  81. #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0)
  82. /* STREQN is an optimised strncmp(a,b,n)==0; assumes n > 0 */
  83. #define STREQN(a, b, n) ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)
  84. #define STRLEN(s) (sizeof (s) - 1)    /* s must be a char array */
  85.  
  86. #ifdef AMIGA
  87. # define index    strchr
  88. # define rindex    strrchr
  89. #endif /* AMIGA */
  90.  
  91. #ifdef FASTINDEX
  92. #define INDEX(src, chr, dest) (dest) = index(src, chr)
  93. extern char *index();
  94. #else
  95. #define INDEX(src, chr, dest) \
  96.     for ((dest) = (src); *(dest) != '\0' && *(dest) != (chr); ++(dest)) \
  97.         ; \
  98.     if (*(dest) == '\0') \
  99.         (dest) = NULL        /* N.B.: missing semi-colon */
  100. #endif
  101.  
  102. /* macros, of necessity */
  103. /* nnafree(any **) where "any" is any type; must be a macro */
  104. #define nnafree(mempp) (*(mempp) != 0 ? \
  105.     (free((char *)*(mempp)), (*(mempp) = 0)) : 0)
  106. #ifdef lint
  107. nnfree(mempp)        /* If *mempp is non-null, free it and zero it. */
  108. register char **mempp;            /* pointer to malloc'ed ptr. */
  109. {
  110.     if (*mempp != 0) {
  111.         free(*mempp);
  112.         *mempp = 0;
  113.     }
  114. }
  115. #else                    /* lint */
  116. #define nnfree nnafree
  117. #endif                    /* lint */
  118.  
  119. #define YES 1
  120. #define NO 0
  121.  
  122. #define NOTALLHDRS NO        /* hdrdump flags for "all headers seen?" */
  123. #define ALLHDRS YES
  124.  
  125. #define DEFEXP "-"            /* default expiry period */
  126.  
  127. /* imports from news */
  128. extern char *progname;
  129.  
  130. extern void fclsexec();                /* from libos */
  131. extern FILE *fopenexcl();            /* from libos */
  132. extern char *getcwd();                /* from libos */
  133.  
  134. extern FILE *fopenclex(), *fopenwclex(); /* from libcnews/fopenclex.c */
  135. extern char *gethdr();                /* from libcnews/gethdr.c */
  136. extern char *hostname();            /* from libcnews/hostname.c */
  137. extern void lockdebug();            /* from libcnews/lock.c */
  138. extern void newslock(), newsunlock(); /* from libcnews/lock.c *
  139.  
  140. extern void errunlock();            /* from libcnews/lock.c */
  141. extern int ltozan(), ltoza();        /* from libcnews/ltoza.c */
  142. extern void matchdebug();            /* from libcnews/ngmatch.c */
  143. extern boolean ngmatch();            /* from libcnews/ngmatch.c */
  144. extern void mkfilenm(), trim();        /* from libcnews/string.c */
  145. extern boolean anyhostin(), hostin();/* from libcnews/string.c */
  146. extern int hopcount();                /* from libcnews/string.c */
  147. extern char *skipsp(), *first(), *strsvto(); /* from libcnews/string.c */
  148. extern char *sendersite(), *nullify();    /* from libcnews/string.c */
  149. extern char *canonpath();            /* from libcnews/string.c */
  150. extern void timestamp();            /* from libcnews/time.c */
  151.  
  152. extern void warning(), error();        /* from libc */
  153. extern void standard();                /* from libc */
  154. extern void closeall();                /* from libc */
  155. extern void stdfdopen();            /* from libc */
  156. extern int nfclose();                /* from libc */
  157.  
  158. #include "alloc.h"                /* ugh */
  159. #endif /* _NEWS_H_ */
  160.  
  161.