home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 1 / GoldFishApril1994_CD2.img / d4xx / d473 / cnewssrc / cnews_src.lzh / include / news.h < prev    next >
C/C++ Source or Header  |  1990-12-22  |  5KB  |  143 lines

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