home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume24 / newsgate / part03 / gate.h next >
C/C++ Source or Header  |  1991-10-09  |  7KB  |  226 lines

  1. /*
  2. **  HEADER FILE FOR NEWS/MAIL GATEWAY CODE.
  3. **  $Header: /nfs/papaya/u2/rsalz/src/newsgate/src/RCS/gate.h,v 1.12 91/03/13 15:59:23 rsalz Exp $
  4. */
  5.  
  6.  
  7. /*
  8. **  START OF CONFIGURATION SECTION
  9. */
  10.  
  11.  
  12. /* Paths to some parts of your netnews installation.  Required. */
  13. #define INEWS        "/usr/lib/news/inews"
  14. #define ACTIVE        "/usr/lib/news/active"
  15. #define NGDELIM        ','
  16.  
  17.  
  18. /* In writing Paths into From addresses, we can look at the output
  19.  * of uuname from the L.sys file.  Define both or neither of the next
  20.  * two.  We can also map some UUCP names to their domain names, if
  21.  * the third line is enabled.  The UUCP_INET should match the value
  22.  * in the Makefile.  This violates the "write once" rule, but it's
  23.  * too much of a pain to fix for this one symbol. */
  24. #define UUNAME        "/usr/lib/news/.admin/uuname.out"
  25. #define L_SYS        "/usr/lib/uucp/L.sys"
  26. #define UUCP_INET    "/usr/lib/news/.admin/uucp-2-inet"
  27.  
  28.  
  29. /* Where does the control file for talk.foo live?
  30.  *    IN_ONEPLACE:    specified filename
  31.  *    IN_SPOOLDIR:    /usr/spool/news/talk/foo/recnews.cmd
  32.  *    IN_CMDDIR:    /usr/lib/news/.admin/talk.foo
  33.  * One of these is required, but you can set IN_ONEPLACE to /dev/null to
  34.  * disable the newsgroup editing. */
  35. /*efine IN_ONEPLACE    "/dev/null"        /* .. */
  36. /*efine IN_SPOOLDIR    "/usr/spool/news"    /* .. */
  37. #define    IN_CMDDIR    "/usr/lib/news/.admin"    /* .. */
  38.  
  39.  
  40. /* What do you want to do with the Path: line?  Put in a fixed string
  41.  * (such as pointing to a mail reflector saying "Don't trust Path:
  42.  * lines as a way to reply").  Put a fixed "fake host" in the Path:,
  43.  * or just put the user's host there.  The latter two can cause the
  44.  * poster's site to never get the article.  Anyhow, pick one.  To pick
  45.  * neither #define is to get the third behavior -- the user's host. */
  46. #define FIXED_PATH    "news-mail-gateway"    /* .. */
  47. /*efine    GATEWAY_NAME    "gateway"        /* .. */
  48.  
  49.  
  50. /* The code in hdr.c does lots of work to canonicalize addresses.  You
  51.  * shouldn't disable it, but at least one beta-tester wanted to, sigh. */
  52. #define DO_ADDRESS_CLEANUP            /* .. */
  53.  
  54.  
  55. /* Are you running sendmail or MMDF?  Pick one.  If you believe in
  56.  * trusted users (MMDF doesn't?) to lie to your mailer, set the
  57.  * user-ID. */
  58. /*efine SENDMAIL    "/usr/lib/sendmail"    /* .. */
  59. #define    MMDF        "/usr/mmdf/lib/submit"    /* .. */
  60. /*efine TRUSTED        1            /* .. */
  61.  
  62.  
  63. /* Does your Sendmail mailer have the M flag on? */
  64. #ifdef    SENDMAIL
  65. #define REQUIRE_MESSAGE_ID            /* .. */
  66. #endif    /* SENDMAIL */
  67.  
  68.  
  69. /* I love how we all speak the same language. */
  70. /*efine CATCHER        int        /* Type of a signal-catcher    */
  71. #define CATCHER        void        /* .. */
  72. #define IDX        index        /* .. */
  73. #define RDX        rindex        /* .. */
  74. /*efine IDX        strchr        /* .. */
  75. /*efine RDX        strrchr        /* .. */
  76. typedef int        *align_t;    /* Worst-case alignment, for lint */
  77. #define CHARSTAR_SPRINTF        /* Need extern char *sprintf();    */
  78. #define VOID_EXIT            /* Need extern void exit();    */
  79. #define HAVE_SYSEXITS            /* Have <sysexits.h>?        */
  80. #define HAVE_TIMEB            /* Have <sys/timeb.h>?        */
  81. #define HAVE_PUTENV            /* Have putenv(3)        */
  82. /*efine HAVE_STRERROR            /* Have strerror(3)?        */
  83.  
  84. #define SM_SIZE        512        /* A smallish buffer size    */
  85. #define LG_SIZE        1024        /* big buffer size        */
  86.  
  87. /* Error log (stderr) for news2mail. */
  88. #define ERR_LOG        "/usr/lib/news/.admin/news2mail.out"
  89. #define TEMPFILE    "/tmp/gateXXXXXX" /* Temporary file pattern    */
  90.  
  91.  
  92. /* Enable debugging code? */
  93. #define STATIC        static
  94. #ifdef    lint
  95. #undef    RCSID
  96. #else
  97. #define RCSID
  98. #endif    /* lint */
  99.  
  100. /*
  101. **  END OF CONFIGURATION SECTION.
  102. */
  103.  
  104.  
  105.  
  106. #include <stdio.h>
  107. #include <ctype.h>
  108. #include <sys/types.h>
  109.  
  110. #ifdef    HAVE_SYSEXITS
  111. #include <sysexits.h>
  112. #else
  113. #include "sysexits.h"
  114. #endif    /* HAVE_SYSEXITS */
  115.  
  116.  
  117. typedef struct _HBUF {
  118.     char    approved[SM_SIZE];    /* Approved:        */
  119.     char    ctlmsg[LG_SIZE];    /* Control:        */
  120.     char    subdate[SM_SIZE];    /* Date: (submission)    */
  121.     char    distribution[SM_SIZE];    /* Distribution:    */
  122.     char    expdate[SM_SIZE];    /* Expires:        */
  123.     char    followto[SM_SIZE];    /* Followup-to:        */
  124.     char    from[SM_SIZE];        /* From:        */
  125.     char    followid[SM_SIZE];    /* References:        */
  126.     char    keywords[SM_SIZE];    /* Keywords:        */
  127.     char    ident[SM_SIZE];        /* Message-ID:        */
  128.     char    nbuf[LG_SIZE];        /* Newsgroups:        */
  129.     char    organization[SM_SIZE];    /* Organization:    */
  130.     char    title[SM_SIZE];        /* Subject:        */
  131.     char    replyto[SM_SIZE];    /* Reply-To:        */
  132.     char    summary[SM_SIZE];    /* Summary:        */
  133.     char    path[LG_SIZE];        /* Path:        */
  134.     char    sender[SM_SIZE];    /* Sender:        */
  135. } HBUF;
  136.  
  137.  
  138. /* String and memory manipulators. */
  139. #define APPEND(p, t)    strlen(strcpy((p), (t)))
  140. #define NEW(T, c)    (T *)MyAlloc((c) * sizeof (T))
  141. #define COPY(s)        ((s) ? strcpy(NEW(char, strlen((s)) + 1), (s)) : NULL)
  142. #define REALLOC(p, s)    realloc((char *)(p), (unsigned int)(s))
  143.  
  144.  
  145. /* Array sizing. */
  146. #define SIZEOF(x)    (sizeof x / sizeof x[0])
  147. #define ENDOF(x)    (&x[SIZEOF(x)])
  148.  
  149.  
  150. /* String and character operations. */
  151. #define WHITE(c)    ((c) == ' ' || (c) == '\t')
  152. #define EQ(a, b)    ((a)[0] == (b)[0] && strcmp((a), (b)) == 0)
  153. #define EQn(a, b, n)    ((a)[0] == (b)[0] && strncmp((a), (b), (n)) == 0)
  154. #define NETCHR(c)    ((c) == '.' || (c) == '%' || (c) == '@' || (c) == '!')
  155. #define CHREQ(c, d)    ((d) == (islower((c)) ? toupper((c)) : (c)))
  156.  
  157.  
  158. /* Fundamental constants of the universe. */
  159. #define TRUE        1
  160. #define FALSE        0
  161. #define FAIL        (-1)
  162.  
  163.  
  164. /* SHUT UP! */
  165. #ifdef    lint
  166. #undef    putc
  167. #undef    putchar
  168. #endif    /* lint */
  169.  
  170. #define Close        (void)close
  171. #define Fflush        (void)fflush
  172. #define Fprintf        (void)fprintf
  173. #define Fputs        (void)fputs
  174. #define Signal        (void)signal
  175. #define Sprintf        (void)sprintf
  176. #define Strcpy        (void)strcpy
  177. #define Strcat        (void)strcat
  178. #define Strncpy        (void)strncpy
  179.  
  180.  
  181. /*
  182. **  External declarations.
  183. */
  184.  
  185. /* Program name; exists once for each main(). */
  186. extern    char    *Pname;
  187.  
  188. /* Routines we provide. */
  189. extern align_t    MyAlloc();
  190. extern int    Split();
  191. extern int    CrackFrom();
  192. extern void    re_modw();
  193. extern void    SplitFree();
  194. extern void    FreeFile();
  195. extern char    **ReadFile();
  196. extern char    *re_comp();
  197. extern char    *HackHeader();
  198.  
  199. extern char    *strerror();
  200.  
  201. /* Variables and routines that Unix(tm) provides. */
  202. extern int    errno;
  203. extern int    sys_nerr;
  204. extern int    optind;
  205. extern char    *sys_errlist[];
  206. extern char    **environ;
  207. extern char    *optarg;
  208.  
  209. extern FILE    *popen();
  210. extern char    *IDX();
  211. extern char    *RDX();
  212. extern char    *ctime();
  213. extern char    *malloc();
  214. extern char    *mktemp();
  215. extern char    *realloc();
  216. extern char    *strcat();
  217. extern char    *strncat();
  218. extern char    *strcpy();
  219. extern char    *strncpy();
  220. #ifdef    CHARSTAR_SPRINTF
  221. extern char    *sprintf();
  222. #endif    /* CHARSTAR_SPRINTF */
  223. #ifdef    VOID_EXIT
  224. extern void    exit();
  225. #endif    /* VOID_EXIT */
  226.