home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
300-399
/
ff319.lzh
/
CNewsSrc
/
cnews.src.lzh
/
relay
/
hdrdefs.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-07-08
|
5KB
|
148 lines
#ifdef AMIGA /* Some type of Amiga */
# ifndef MCH_AMIGA /* Not Manx 3.6a, but ... */
# define LATTICE_4_0 /* Because of all the compiler bugs!! */
# define CONST
# else
# define LATTICE_4_0 /* Because of all the compiler bugs!! */
/* temporary */
# define CONST /* const */
# endif
#endif
/*
* Usenet header definitions (see ARPA Internet RFCs 1036 nee 850 & 822;
* for a second opinion, see The Hideous Name by Pike & Weinberger).
*
* Headers are parsed and modified and copied in one pass.
* Nevertheless, the code is in pieces: hdrdefs.c, hdrcommon.c,
* hdrparse.c, hdrmunge.c.
*/
#include <stdio.h>
#ifndef AMIGA
# include <sys/types.h>
#endif /* AMIGA */
#ifdef REALSTDC
# include <stdlib.h>
#endif /* REALSTDC */
#include "news.h"
#include "headers.h"
#include "hdrint.h" /* may define "CONST" */
#ifndef offsetof
#define offsetof(type, mem) ((char *)&((type *)NULL)->mem - (char *)NULL)
#endif
/* "mandatory" headers (also From:, Date:) */
static CONST char msgnm[] = "Message-ID:"; /* for rejection */
static CONST char ngsnm[] = "Newsgroups:"; /* filing, clone for Xref */
static CONST char pathnm[] = "Path:"; /* rejection, extend (damn) */
static CONST char subjnm[] = "Subject:"; /* for ctl. msgs. */
/* optional headers */
static CONST char appnm[] = "Approved:"; /* for mod. groups */
static CONST char ctlnm[] = "Control:"; /* ctl. msg. */
static CONST char expnm[] = "Expires:"; /* for history */
static CONST char distrnm[] = "Distribution:"; /* for transmission */
static CONST char sendnm[] = "Sender:"; /* for mod. groups */
static CONST char xrefnm[] = "Xref:"; /* to *replace* (damn!)*/
/* obsolete "useful" headers */
static CONST char artnm[] = "Article-I.D.:"; /* obs. Message-ID: */
/* obsolete useless headers: delete them all on contact */
static CONST char datercvnm[] = "Date-Received:";
static CONST char rcvnm[] = "Received:"; /* obsolete Date-Received: */
static CONST char postnm[] = "Posted:"; /* obsolete Date: */
static CONST char postversnm[] = "Posting-Version:";
static CONST char rlyversnm[] = "Relay-Version:";
static CONST char illobjnm[] = "Illegal-Object:"; /* zmailer bitching */
#ifdef LATTICE_4_0
static CONST struct hdrdef msghdr = { msgnm, STRLEN(msgnm), 20 };
static CONST struct hdrdef ngshdr = { ngsnm, STRLEN(ngsnm), 4 };
CONST struct hdrdef pathhdr = { pathnm, STRLEN(pathnm), 32 };
static CONST struct hdrdef subjhdr = { subjnm, STRLEN(subjnm), 0 };
static CONST struct hdrdef apphdr = { appnm, STRLEN(appnm), 16 };
static CONST struct hdrdef ctlhdr = { ctlnm, STRLEN(ctlnm), 12 };
static CONST struct hdrdef exphdr = { expnm, STRLEN(expnm), 28 };
static CONST struct hdrdef distrhdr = { distrnm, STRLEN(distrnm), 8 };
static CONST struct hdrdef sendhdr = { sendnm, STRLEN(sendnm), 24 };
CONST struct hdrdef xrefhdr = { xrefnm, STRLEN(xrefnm), -1 };
static CONST struct hdrdef arthdr = { artnm, STRLEN(artnm), 24 };
#else /************************************************************/
static CONST struct hdrdef msghdr = {
msgnm, STRLEN(msgnm), offsetof(struct headers, h_msgid) };
static CONST struct hdrdef ngshdr = {
ngsnm, STRLEN(ngsnm), offsetof(struct headers, h_ngs) };
CONST struct hdrdef pathhdr = {
pathnm, STRLEN(pathnm), offsetof(struct headers, h_path) };
static CONST struct hdrdef subjhdr = {
subjnm, STRLEN(subjnm), offsetof(struct headers, h_subj) };
static CONST struct hdrdef apphdr = {
appnm, STRLEN(appnm), offsetof(struct headers, h_approved) };
static CONST struct hdrdef ctlhdr = {
ctlnm, STRLEN(ctlnm), offsetof(struct headers, h_ctlcmd) };
static CONST struct hdrdef exphdr = {
expnm, STRLEN(expnm), offsetof(struct headers, h_expiry) };
static CONST struct hdrdef distrhdr = {
distrnm, STRLEN(distrnm), offsetof(struct headers, h_distr) };
static CONST struct hdrdef sendhdr = {
sendnm, STRLEN(sendnm), offsetof(struct headers, h_sender) };
CONST struct hdrdef xrefhdr = { xrefnm, STRLEN(xrefnm), -1 };
static CONST struct hdrdef arthdr = {
artnm, STRLEN(artnm), offsetof(struct headers, h_artid) };
#endif /* LATTICE_4_0 */
static CONST struct hdrdef datrcvhdr = { datercvnm, STRLEN(datercvnm), -1 };
static CONST struct hdrdef rcvhdr = { rcvnm, STRLEN(rcvnm), -1 };
static CONST struct hdrdef psthdr = { postnm, STRLEN(postnm), -1 };
static CONST struct hdrdef pstvrshdr = { postversnm, STRLEN(postversnm), -1 };
static CONST struct hdrdef rlyvrshdr = { rlyversnm, STRLEN(rlyversnm), -1 };
static CONST struct hdrdef illobjhdr = { illobjnm, STRLEN(illobjnm), -1 };
/* these are parsed into a struct headers */
CONST struct hdrdef *parsehdrs[] = {
&msghdr,
&arthdr, /* obsolete */
&ngshdr,
&pathhdr, /* modified by hdrmunge.c (emithdr()) */
&subjhdr,
/* start optional headers */
&apphdr,
&ctlhdr,
&distrhdr,
&exphdr,
&sendhdr,
NULL
};
/*
* the following noxious headers are deleted on contact because neighbours
* still send them and they are big. in an ideal world, they wouldn't be
* sent and thus we wouldn't need to delete them.
*
* It is tempting to delete Article-I.D.: too, but it may be too soon
* for that.
*/
CONST struct hdrdef *hdrvilest[] = {
&xrefhdr, /* regenerated by fileart() if needed */
&datrcvhdr,
&rcvhdr,
&psthdr,
&pstvrshdr,
&rlyvrshdr,
&illobjhdr,
NULL,
};
boolean headdebug = NO;