[comp.sources.unix] v19i089: Cnews production release, Part12/19

rsalz@uunet.uu.net (Rich Salz) (06/28/89)

Submitted-by: utzoo!henry
Posting-number: Volume 19, Issue 89
Archive-name: cnews2/part12

: ---CUT HERE---
echo 'man/rnews.8':
sed 's/^X//' >'man/rnews.8' <<'!'
X.\" =()<.ds a @<NEWSARTS>@>()=
X.ds a /usr/spool/news
X.\" =()<.ds b @<NEWSBIN>@>()=
X.ds b /usr/lib/newsbin
X.\" =()<.ds c @<NEWSCTL>@>()=
X.ds c /usr/lib/news
X.\" =()<.ds m @<NEWSMASTER>@>()=
X.ds m usenet
X.TH RNEWS 8 "22 June 1989" "C News"
X.SH NAME
Xrnews, cunbatch \- accept and spool news input
X.br
Xnewsspool, newsrun, c7decode \- news input spooler and processing
X.br
Xnewsrunning \- control news-processing daemon
X.SH SYNOPSIS
X.B rnews
X[ file ... ]
X.br
X.B cunbatch
X[ file ... ]
X.br
X.B \*b/input/newsspool
X[
X.B \-i
X] [ file ... ]
X.br
X.B \*b/input/newsrun
X.br
X.B \*b/input/c7decode
X.br
X.B \*b/input/newsrunning
X{\fBon\fR|\fBoff\fR}
X.SH DESCRIPTION
X.I Rnews
Xaccepts the named \fIfile\fR(s) (standard input default)
Xas news, and spools it up for processing, space permitting.
X.I Cunbatch
Xis a historical synonym for
X.IR rnews ;
Xthere is no difference in what they do.
X.PP
X.I Newsspool
Xis the actual spooling program.
XIt creates a spool file with a name based on the current time
X(which avoids the need for locking) in the spooling directory
X\fI\*a/in.coming\fR and copies the input \fIfile\fR(s) (standard input
Xdefault) to it, stripping off any `\fB#!\ cunbatch\fR'
Xor `\fB#!\ c7unbatch\fR' header as it does so.
XIf invoked with the
X.B \-i
Xoption, when finished it attempts to start
X.I newsrun
Xto process the new news immediately.
X.PP
X.I Newsrun
Xshould be run periodically (e.g. by \fIcron\fR(8)) to process spooled news.
X.I Newsrunning
Xcan be used to enable and disable \fInewsrun\fR's processing if it is desired
Xto avoid major news processing during certain hours.
X.PP
X.I Newsrun
Xchecks for the \fIstop\fR file that
X\fInewsrunning\ off\fR creates,
Xverifies that there is enough disk space for processing,
Xand then starts processing spooled news.
XEach batch is
Xrun through \fIc7decode\fR (if necessary),
Xde\fIcompress\fRed (if necessary), and then fed
Xto
X\fIrelaynews\fR
X(on the server, if \fI\*c/server\fR exists and contains its name).
XIf \fIrelaynews\fR fails,
X\fInewsrun\fR reports this (by mail to \fB\*m\fR) and attempts to save
Xthe spooled batch in the \fIbad\fR subdirectory for human inspection.
XTo bound the accumulation in \fIbad\fR in the event of some systematic
Xproblem, \fInewsrun\fR limits \fIbad\fR to 50 files;
Xthis default can be changed by placing a \fIlimit\fR file in \fIbad\fR,
Xcontaining one ASCII line with the desired numeric limit.
XA limit of 0 will prevent saving of bad batches.
X.PP
X.I C7decode
Xpasses standard input to standard output, decoding a complex and bizarre
Xencoding of 8-bit data as printable ASCII characters.
X.SH FILES
X.nf
X(All in \fI\*a/in.coming\fR)
X.sp
X.ta 2.5c
X000000000	(etc.) spooled news
Xstop	\fInewsrun\fR disable file
Xbad	directory for failed news
Xbad/limit	limit on number of files in \fIbad\fR
X.SH SEE ALSO
Xcompress(1),
Xnewsbatch(8),
Xnewsmail(8),
Xrelaynews(8)
X.SH DIAGNOSTICS
XComplaints are mailed to \fB\*m\fR if something goes wrong.
X.SH HISTORY
XPart of C News.
XWritten at University of Toronto by Henry Spencer.
X.SH BUGS
X\fIC7decode\fR should be part of the underlying transport mechanism.
XIt hasn't been tested very well in the C News environment.
X\fIBdecode\fR (see \fInewsmail\fR(8)) is probably better for most uses.
!
echo 'man/relaynews.8':
sed 's/^X//' >'man/relaynews.8' <<'!'
X.\" =()<.ds a @<NEWSARTS>@>()=
X.ds a /usr/spool/news
X.\" =()<.ds b @<NEWSBIN>@>()=
X.ds b /usr/lib/newsbin
X.\" =()<.ds c @<NEWSCTL>@>()=
X.ds c /usr/lib/news
X.\" =()<.ds m @<NEWSMASTER>@>()=
X.ds m usenet
X.TH RELAYNEWS 8 "28 May 1989" "C News"
X.SH NAME
Xrelaynews \- store and forward netnews articles
X.SH SYNOPSIS
X.B relaynews
X[
X.B \-inrs
X]
X[
X.B \-d
X.B fhlmt
X]
X[
X.B \-x
Xexcluded-site
X]
X.SH DESCRIPTION
X.I Relaynews
Xinstalls locally
Xand
Xbroadcasts (network) news articles
Xread from its standard input.
XTypically the articles will be in a batch
X(see
X.IR news (5)),
Xwhich may
X.I not
Xbe compressed
X(see
X.IR compress (1)).
XArticles are usually
Xqueued for transmission to one's netnews neighbours via
X.IR newsbatch (8)
Xand thence via
X.IR uux (1)
Xor
X.IR mail (1).
X.PP
X.B \-d
Xturns on debugging of
X.BR f iling,
X.BR h eaders,
X.BR l ocking,
X.BR m atching,
X.BR t ransmission.
X.B \-r
Xredirects stdout and stderr to
X.B \*c/log
Xand
X.BR \*c/errlog .
X.B \-i
Xredirects stdout only to
X.BR \*c/log .
X.B \-n
Xenables ``NNTP mode''
Xin which history entries are generated as articles are rejected.
X.B \-s
Xmakes discarding an article a serious matter.
X.B \-x
Xexcludes
X.I excluded-site
Xfrom the list of netnews neighbours to receive article(s).
X.PP
X.IR "Control messages" ,
Xrecognised by their
X.B Control:
Xheaders
X(or
X.B "for backward compatibility ONLY"
Xa
X.B Newsgroups:
Xheader containing a single newsgroup ending in
X.BR .ctl ),
Xare filed under the
X.B control
Xpseudo-group only,
Xbut are forwarded as usual,
Xby examining their
X.B Newsgroups:
Xand
X.B Distribution:
Xheaders.
XNote that posting to the
X.B control
Xpseudo-group
Xwill not cause a message to be treated as a control message;
X.B control
Xis not a real newsgroup.
X.PP
XArticles which contain no locally-known
X(to the
X.I active
Xfile)
Xnewsgroups
Xyet accepted by the local subscription list
Xare filed exactly once,
Xin the
X.B junk
Xpseudo-group,
Xand forwarded as usual.
XIn particular,
Xif all newsgroups in the article are refused by
Xthe local subscription list
Xor
Xare refused by an
X.B x
Xin
X.I active
Xfile entries,
Xthen the article will be
X.I discarded
Xand not filed in
X.BR junk .
X.PP
XLocally-generated articles
Xneed not be permitted by the local subscription list
Xbut are otherwise processed normally;
Xthis is for backward compatibility
Xand perhaps to keep the local subscription list short
Xby not requiring
X.B general
Xand the like to be named.
X.SH FILES
X.PD 0
X.TP 2i
X.B \*a
Xnetnews article tree
X.TP
X.B \*a/comp/unix/wizards
Xexample newsgroup directory
X(for
X.BR comp.unix.wizards )
X.TP
X.BI \*a/out.going/ system /togo
Xdefault
X.B sys
Xfile
X.BR F ,
X.B f
Xand
X.B I
Xflags filename
X.TP
X.B \*c/sys
Xdetermines who receives broadcast netnews articles,
Xwhich ones,
Xand
Xhow they are to be sent articles
X.TP
X.B \*c/active
Xcontains locally-legal newsgroups and (un)moderated flag
X.TP
X.B \*c/history
Xrecord of articles received
X.TP
X.B \*c/history.{dir,pag}
X.IR dbm (3)
Xindex into
X.B history
X.TP
X.B \*c/whoami
Xif present,
Xcontains news system's site name,
Xoverriding any other host names
X.TP
X.B \*c/log
Xlog of incoming articles
X.TP
X.B \*c/errlog
Xlog of errors, should be empty
X.TP
X.B \*c/bin
Xsystem-specific directory of programs to
Xoverride
X.B \*b
Xand its subdirectories
X.TP
X.B \*b/ctl
Xcommon directory of programs to implement control messages
X.TP
X.B \*b/relay/relaynews
Xthe lean, mean news-relayin' machine
X.TP
X.B \*b/newsreply
Xgenerates a return address from article headers
X.PD
X.SH "SEE ALSO"
X.IR compress (1),
X.IR mail (1),
X.IR uux (1),
X.IR dbm (3),
X.IR news (5),
X.IR newsbatch (8)
X.br
XARPA Internet RFCs 1036 and 850
X.SH DIAGNOSTICS
XUsually found in
X.BR \*c/errlog .
X.br
X.IR Relaynews 's
Xexit status is a bit vector of status bits;
Xsee
X.B news/include/news.h
Xfor the bit definitions.
X.SH HISTORY
XWritten by Geoff Collyer
Xat the University of Toronto
Xas part of the C news project.
X.SH BUGS
XAn article with a header that does not fit entirely in a
Xstatic buffer
Xand on a machine without real links
X(e.g. something like Eunice but on a PDP-11)
Xwill be filed incorrectly:
Xany symbolic links under \*a will point at a non-existent
Xfilename.
X.br
XA control message which cannot be filed in the
X.B control
Xpseudo-group
Xand
Xwhich cannot be filed in the
X.B junk
Xpseudo-group because
X.B junk
Xis not in the
X.I active
Xfile will generate an error message
Xwhich refers to the groups in its
X.B Newsgroups:
Xheader instead of referring to the
X.B control
Xpseudo-group.
X.br
X.I Relaynews
Xcould run faster in some circumstances
Xand would be simpler
Xif
X.I Control:
Xwere required to be the first header,
Xif present,
Xand if
X.I Newsgroups:
Xwere required to be the next.
!
echo 'man/newsbatch.8':
sed 's/^X//' >'man/newsbatch.8' <<'!'
X.\" =()<.ds a @<NEWSARTS>@>()=
X.ds a /usr/spool/news
X.\" =()<.ds b @<NEWSBIN>@>()=
X.ds b /usr/lib/newsbin
X.\" =()<.ds c @<NEWSCTL>@>()=
X.ds c /usr/lib/news
X.\" =()<.ds m @<NEWSMASTER>@>()=
X.ds m usenet
X.TH NEWSBATCH 8 "28 May 1989" "C News"
X.SH NAME
Xsendbatches, batchsplit \- news batching to other sites
X.br
Xbatcher, batchih, batchsm \- news-batch preparation
X.br
Xcomp, nocomp, compcun, compc7, compb \- news-batch compression
X.br
Xc7encode, bencode \- compressed-news-batch encoding
X.br
Xviauux, viainews, viamail, viapmail \- news-batch transmission
X.SH SYNOPSIS
X.B \*b/batch/sendbatches
X[ site ... ]
X.PP
X.B \&.../batchsplit
Xbatchsize
X.br
X.B \&.../batcher
X[
X.B \-d
Xdirectory
X]
Xlistfile
X.br
X.B \&.../batchih
X[
X.B \-d
Xdirectory
X]
Xlistfile
X.br
X.B \&.../batchsm
X[
X.B \-d
Xdirectory
X]
Xlistfile
X.br
X.B \&.../comp
X.br
X.B \&.../nocomp
X.br
X.B \&.../compcun
X.br
X.B \&.../compc7
X.br
X.B \&.../compb
X.br
X.B \&.../c7encode
X.br
X.B \&.../bencode
X[ file ]
X.br	
X.B \&.../viauux
Xsite
X.br
X.B \&.../viainews
Xsite
X.br
X.B \&.../viamail
Xsite
X.br
X.B \&.../viapmail
Xsite
X.SH DESCRIPTION
X.I Sendbatches
Xadministers batched transmission of news to other sites.
XIt should be run periodically, under userid \fInews\fR,
Xby \fIcron\fR(8) or similar means.
XIt prepares and sends batches of news,
Xsubject to restrictions on available space and length of outbound queues.
X.PP
XEach site that can have batches sent to it needs a \fIsite\fR directory
Xunder \fI\*a/out.going\fR.
XIf \fIsendbatches\fR is invoked with specific \fIsite\fRs given, it
Xconsiders batching for those sites, only, in that order.
XBy default, \fIsendbatches\fR consults the \fIbatchparms\fR file (see below)
Xto determine what to do:
XIf there is a \fB/default/\fR entry in \fIbatchparms\fR, \fIsendbatches\fR
Xwill consider batching for all sites that have directories in
X\fI\*a/out.going\fR, in oldest-first order by modification time of the
Xdirectory.
XIf there is no \fB/default/\fR entry, \fIsendbatches\fR
Xconsiders batching for those sites named in \fIbatchparms\fR, in the
Xorder named.
X.PP
XTo use the batcher, names of files to be sent to a specific site should
Xbe appended to a \fItogo\fR file in its \fIsite\fR directory.
XThe batcher expects the lines in \fItogo\fR to have two fields, a filename
X(as a full pathname) of an article and its size in bytes.
XA missing size field is arbitrarily assumed to be a default average.
X.PP
X\fISendbatches\fR uses a number of auxiliary programs to do the real work.
XThe search path it uses to find them includes, in order,
Xthe \fIsite\fR directory for the site in question,
X\fI\*c/bin\fR, and \fI\*b/batch\fR.
XThis permits per-site and per-news-database overrides of the default
Xbehaviors.
X\fISendbatches\fR provides all these programs with an environment
Xvariable \fBNEWSSITE\fR, containing the name of the site that batches
Xare being prepared for, in case this is useful in customization.
X.PP
XThe names of most of the auxiliary programs, and some other parameters,
Xare taken from the file \fI\*c/batchparms\fR, an ASCII text file.
XEmpty lines and lines starting with `#' are ignored.
XOther lines specify the behavior for sites, one line per site.
XA site line is six fields, separated by white space.
XThe first field is the site name;
Xa line whose site name is \fB/default/\fR specifies what parameters should
Xbe used for sites not explicitly mentioned.
X(The presence or absence of such a line also influences the behavior of
X\fIsendbatches\fR when invoked without arguments; see above.)
XThe second field is the size of batches to be prepared (before compression),
Xin bytes.
XThe third field is the maximum number of batches to be queued up for
Xtransmission to that site.
XThe fourth, fifth, and sixth fields are the names of the programs to
Xbe used to build, compress, and transmit (respectively) batches to that site.
X.PP
XFor each site being considered for batches, \fIsendbatches\fR first
Xdetermines whether there are in fact any articles to be batched.
XAssuming there are, \fIsendbatches\fR then
Xfinds the \fIbatchparms\fR line for that site
Xand
Xinvokes \fIqueuelen\fR (see \fInewsaux\fR(8))
Xto find out how many batches are in the outbound queue for it already.
X\fISendbatches\fR limits the number of batches prepared to the minimum of
Xthe limits implied by queue lengths and available space.
X.PP
X\fISendbatches\fR uses \fIbatchsplit\fR
Xas necessary
Xto slice chunks out of the \fItogo\fR
Xfile, each chunk containing the
X\fItogo\fR lines for a batch limited to the specified size.
XException:  a single article bigger than the specified size will still go out
Xas one batch.
X.PP
XEach chunk is then processed through a batch preparer
X(typically \fIbatcher\fR), which assembles the
Xarticles into a batch,
Xa batch compressor (typically \fIcompcun\fR),
Xwhich performs compression and/or any other auxiliary processing
Xneeded, and a batch transmitter (typically \fIviauux\fR),
Xwhich sends the batch on its way (e.g. enqueues it for transmission).
X.PP
XBatch preparers in the standard distribution are:
X.RS
X.IP batcher 9
Xnormal batching
X.IP batchih
X\fIihave\fR part of ihave/sendme
X.IP batchsm
X\fIsendme\fR part of ihave/sendme
X.RE
X.PP
XIf \fIbatcher\fR is invoked with a \fB\-d\fR option, it \fIchdir\fRs to
Xthe \fIdirectory\fR first, and strips it off the beginning of any article
Xfilename that starts with it.
XSince most articles will come from \fI\*a\fR, specifying
X\fB\-d\ \*a\fR to \fIbatcher\fR will speed it up noticeably.
XSince \fIsendbatches\fR does this, other preparers had better be ready
Xto ignore an initial \fB\-d\fR option.
X.PP
XBatch compressors in the standard distribution are:
X.RS
X.IP comp 9
Xordinary
Xcompression
X.IP compcun
Xcompression plus the silly B-news-compatible
X`#!\ cunbatch' header
X.IP nocomp
Xpass data straight through, no compression
X.IP compc7
Xcompression plus 7-bit encoding using
X\fIc7encode\fR
X.IP compb
Xcompression plus very conservative 6-bit encoding
Xusing \fIbencode\fR
X.RE
X.PP
XBatch transmitters in the standard distribution are:
X.RS
X.IP viauux 9
Xnormal transmission via UUCP
X.IP viainews
Xfeed the batch back to \fIinews\fR, ignoring the \fIsite\fR argument
X(normally useful only for ihave/sendme)
X.IP viamail
Xmail the batch to \fIsite\fB!rnews\fR
X.IP viapmail
Xmail the batch to \fIsite\fB!rnews\fR, attempting to
Xprotect an unencoded batch against the vagaries of mailers
X.RE
X.PP
X.I C7encode
Xencodes 8-bit data from standard input into a 7-bit form optimized for
Xtransmission by uucp `f' protocol.
XThe encoding is complex and bizarre.
X.PP
X.I Bencode
Xtakes 8-bit data from
Xthe named source file (the default is standard input)
Xand encodes it
Xusing only the ASCII characters ``A'' \- ``Z'', ``a'' \- ``z'', ``0''
X\- ``9'', ``+'', and ``-''.
XThe ASCII characters blank, newline, and ``/'' also appear in the
Xencoded file, but do not represent encoded bits.
XThe encoded file is terminated with
Xa byte count and cyclic redundancy check for detecting corrupted files.
XThis ought to suffice to get data through almost any network.
X.PP
X\fISendbatches\fR logs some information about sites with backlogs in
X\fI\*c/batchlog\fR, keeping the previous \fIbatchlog\fR in
X\fIbatchlog.o\fR and the one before that in \fIbatchlog.oo\fR.
XThis is intended to help detection and diagnosis of flow problems.
X.SH FILES
X.ta \w'\*a/out.going/*'u+2n
X.nf
X\*c/LOCKbatch	lock for \fIsendbatches\fR
X\*c/LOCK	overall news lock (used by \fIbatchsplit\fR)
X\*c/L.*	lock temporaries
X\*a/out.going/*	batch directories
X\*c/batchparms	parameter file
X
Xalso see text
X.SH SEE ALSO
Xinews(1), compress(1), uux(1), relaynews(8), rnews(8)
X.SH HISTORY
XWritten at University of Toronto as part of the C News project.
XA number of the ideas came from Chris Lewis, who was then with Motorola.
X.I Bencode
Xwritten at University of Waterloo
Xby Reg Quinton and Ken Lalonde.
X.SH BUGS
X\fIBatchsplit\fR does not count the `#!\ rnews\ \fInnnn\fR' headers inside
Xbatches when computing batch lengths.
X.PP
XIhave/sendme processing is a bit of a kludge;
Xin particular, applying \fIbatchsplit\fR to a file full of article IDs
Xjust happens to work okay.
X.PP
X\fISendbatches\fR estimates available space without considering the
Xeffects of compression;
Xthis is usually too conservative.
X.PP
X\fIViapmail\fR is obsolescent;
X\fIviamail\fR with a batch encoded with \fIbencode\fR is vastly superior.
!
echo 'man/expire.8':
sed 's/^X//' >'man/expire.8' <<'!'
X.\" =()<.ds a @<NEWSARTS>@>()=
X.ds a /usr/spool/news
X.\" =()<.ds b @<NEWSBIN>@>()=
X.ds b /usr/lib/newsbin
X.\" =()<.ds c @<NEWSCTL>@>()=
X.ds c /usr/lib/news
X.\" =()<.ds m @<NEWSMASTER>@>()=
X.ds m usenet
X.TH EXPIRE 8 "5 June 1989" "C News"
X.SH NAME
Xexpire, doexpire \- expire old news
X.br
Xmkhistory \- rebuild news history file
X.br
Xupact \- update news active file
X.br
Xsuperkludge \- implement stupid Supersedes header in news
X.SH SYNOPSIS
X.B \*b/expire/expire
X[
X.B \-a
Xarchdir
X] [
X.B \-p
X] [
X.B \-s
X] [
X.B \-F
Xc
X] [
X.B \-c
X] [
X.B \-n
Xnnnnn
X] [
X.B \-t
X] [
X.B \-l
X] [
X.B \-v
X] [
X.B \-d
X]
X[ controlfile ]
X.br
X.B \*b/expire/doexpire
Xexpireoptions
X.br
X.B \*b/expire/mkhistory
X.br
X.B \*b/expire/upact
X.br
X.B \*b/expire/superkludge
X[
X.B \-v
X]
Xnewsgroup ...
X.SH DESCRIPTION
X.I Expire
Xexpires old news, removing it from the current-news directories and
X(if asked to) archiving it elsewhere.
XIt updates news's
X.I history
Xfile to match.
X.I Expire
Xshould normally be run nightly, typically by using \fIdoexpire\fR (see below).
X.PP
X.IR Expire 's
Xoperations are controlled by a control file
X(which can be named or supplied on standard input),
Xwhich is not optional\(emthere is no default behavior.
XEach line of the control file should have four white-space-separated
Xfields, as follows.
X.PP
XThe first field is one or more newsgroups,
Xseparated by commas (no spaces!);
Xpartial specifications are acceptable (e.g. `comp' specifies all groups
Xwith that prefix).
X.PP
XThe second field is one letter, `m', `u', or `x', specifying that the line
Xapplies only to moderated groups, only to unmoderated groups, or to both,
Xrespectively.
X.PP
XThe third field specifies the expiry period in days.
XThe most general form is three numbers separated by dashes.
XThe units are days; decimal fractions are permitted.
XThe first number gives the retention period:
Xhow long must pass after an article's arrival before it is a candidate
Xfor expiry.
XThe third number gives the purge date:
Xhow long must pass after arrival
Xbefore the article will be expired unconditionally.
XThe middle number gives the default expiry date:
Xhow long after an article's arrival it is expired by default.
XAn explicit expiry date in the article will override the default expiry
Xdate but not the retention period or the purge date.
XIf the field contains only two numbers with a dash separating them,
Xthe retention period defaults to 0.
XIf the field contains only a number, the retention period defaults to 0
Xand the purge date defaults to `never'.
X(But see below.)
X.PP
XThe fourth field is an archiving directory,
Xor `@' which indicates that the default archiving directory (see \fB\-a\fR)
Xshould be used,
Xor `\-' which suppresses archiving.
XAn explicit archiving directory (not `@') prefixed with `=' means
Xthat articles should be archived into that directory itself;
Xnormally they go into subdirectories under it by newsgroup name,
Xas in the current-news directory tree.
X(E.g., article 123 of comp.pc.drivel being archived into archive directory
X\fI/exp\fR would normally become \fI/exp/comp/pc/drivel/123\fR,
Xbut if the archiving
Xdirectory was given as `=/exp' rather than `/exp', it would become
X\fI/exp/123\fR.)
X.I Expire
Xcreates subdirectories under an archiving directory automatically,
Xbut will not create the archiving directory itself.
XArchiving directories must be given as full pathnames.
X.PP
XThe first line of the control file which applies to a given article is
Xused to control its expiry.
XIt is an error for no line to apply;
Xthe last line should be something like `all\ x\ 7\ \-'
Xto ensure that at least one line is always applicable.
XCross-posted articles are treated as if they were independently posted
Xto each group.
X.PP
XThe retention and purge defaults can be overridden by including a
X\fIbounds\fR line,
Xone with the special first field \fB/bounds/\fR;
Xthe retention and purge defaults for following lines will be those of
Xthe bounds line.
XThe other fields of a bounds line are ignored but must be present.
X.PP
XEntries in the \fIhistory\fR file can be retained after article expiry,
Xto stop a late-arriving copy of the article from being taken as a new article.
XTo arrange this, include a line with the special first field \fB/expired/\fR;
Xthis line then controls the expiry of \fIhistory\fR lines after the
Xcorresponding articles expire.
XDates are still measured from article arrival, not expiry.
XThe other fields of such a line are ignored but must be present.
XIt is strongly recommended that such a line be included, and that it
Xspecify as long a time as practical.
X.PP
XCommand-line options are:
X.TP 10
X.BR \-a " dir"
X\fIdir\fR is the default archiving directory;
Xif no default is given, the control file may not contain
Xany `@' archive-directory fields.
X.TP
X.B \-p
Xprint an `index' line for each archived article,
Xcontaining its pathname, message ID, date received, and `Subject:' line.
X.TP
X.B \-s
Xspace is tight; optimize error recovery to minimize space consumed rather
Xthan to leave as much evidence as possible.
X.TP
X.BR \-F " c"
Xthe subfield separator character
Xin the middle \fIhistory\fR field is \fIc\fR rather
Xthan the normal `~'.
X.TP
X.B \-c
Xcheck the format and consistency of the control file and the \fIactive\fR
Xfile, but do not do any expiring.
X.TP
X.BR \-n " nnnnn"
Xset \fIexpire\fR's idea of the time to \fInnnnn\fR (for testing).
X.TP
X.BR \-t
Xprint (on standard error) a shell-script-like description of what would
Xbe done, but don't do it.
X.TP
X.BR \-l
Xconsider first filename in a \fIhistory\fR line to be the \fIleader\fR of
Xits line, to be expired only after all others have expired.
X(Meant for use on obnoxious systems like VMS which don't support real links.)
X.TP
X.BR \-v
Xverbose:
Xreport some statistics after termination.
X.TP
X.BR \-d
Xturn on (voluminous and cryptic) debugging output.
X.PP
X.I Expire
Xconsiders the middle field of a \fIhistory\fR line to consist of one or
Xmore subfields separated by `~'.
XThe first is the arrival date, which can be either a \fIgetdate\fR(3)-readable
Xdate or a decimal seconds count;
X\fIexpire\fR leaves this field unchanged.
XThe second\(emif present, non-null, and not `\-'\(emis an explicit expiry
Xdate for the file, again in either format, which \fIexpire\fR will convert
Xto a decimal seconds count as it regenerates the \fIhistory\fR file.
XSubsequent fields are preserved but ignored.
X.PP
X.I Doexpire
Xchecks whether another \fIdoexpire\fR is running,
Xchecks that there is enough disk space for expiry and archiving,
Xinvokes \fIexpire\fR with any \fIexpireoptions\fR given and with
X\fI\*c/explist\fR as the control file,
Xand reports any difficulties by sending mail to \fI\*m\fR.
XThis is usually better than just running \fIexpire\fR directly.
X.PP
X.I Mkhistory
Xrebuilds the \fIhistory\fR file and its auxiliaries to match the articles
Xin \fI\*a\fR.
X.I Upact
Xupdates the third fields of the \fIactive\fR file to match the articles
Xin \fI\*a\fR (for historical reasons, \fIexpire\fR does not do this).
XThese programs are both fairly slow and they both lock the whole news
Xsystem for the duration of the run, so they should not be run casually.
X.PP
X.I Superkludge
Xinspects the files in \fI\*a\fR for the \fInewsgroup\fR(s)
Xgiven, and removes any that have been superseded, according to the
X`Supersedes' header, by newer ones.
XThe \fIhistory\fR file is not altered; it's not worth the trouble.
XThe \fB\-v\fR option produces a report of how many articles have been
Xsuperseded in each \fInewsgroup\fR.
X.SH FILES
X.ta 6c
X.nf
X\*c/history	history file
X\*c/history.pag	\fIdbm\fR database for history file
X\*c/history.dir	\fIdbm\fR database for history file
X\*c/explist	expiry control file
X\*c/history.o	history file as of last expiry
X\*c/history.n*	new history file and \fIdbm\fR files abuilding
X\*c/LOCKexpire	\fIdoexpire\fR's lock file
X\*b/expire/*	various auxiliaries
X.SH SEE ALSO
Xinews(1), dbm(3), relaynews(8)
X.SH HISTORY
XWritten at U of Toronto by Henry Spencer, with contributions by Geoff Collyer.
X.SH BUGS
XArchiving is always done by copying, never by linking.
XThis has the side effect that cross-posted articles are archived as
Xseveral independent copies.
X.PP
XThe
X.B \-p
Xsubject-finder botches continued header lines,
Xas does \fImkhistory\fR,
Xalthough such lines are rare.
X.PP
X\fIUpact\fR and \fIsuperkludge\fR are distasteful kludges,
Xbut then, so are the third field of the \fIactive\fR file and the
X`Supersedes' header.
X.PP
XSome of the more obscure options of \fIexpire\fR have not been tested well.
X.PP
XOne cannot put more than one newsgroup into a single archiving directory
Xwith the `=' feature, since the article numbers will collide with each
Xother and expire doesn't do anything about this.
!
echo 'misc/gngp.c':
sed 's/^X//' >'misc/gngp.c' <<'!'
X/*
X * gngp - globally find newsgroup and print
X *	like grep, but for newsgroup patterns instead of regular expressions
X */
X
X#include <stdio.h>
X
Xchar *progname;
Xint debug = 0;
X
X/*
X * if true, match only ng at start of line, followed by whitespace or newline.
X */
Xint anchored = 0;
X
XFILE *efopen();
X
X/*
X * main - parse arguments and handle options
X */
Xmain(argc, argv)
Xint argc;
Xchar *argv[];
X{
X	int c, status = 0;
X	int errflg = 0;
X	FILE *in;
X	extern int optind;
X	extern char *optarg;
X
X	progname = argv[0];
X	while ((c = getopt(argc, argv, "ad")) != EOF)
X		switch (c) {
X		case 'a':		/* anchored at start of line */
X			anchored++;
X			break;
X		case 'd':
X			matchdebug(1);	/* all debugging on */
X			debug++;
X			break;
X		default:
X			errflg++;
X			break;
X		}
X	if (errflg || optind == argc) {
X		(void) fprintf(stderr, "usage: %s [-ad] pattern [file...]\n",
X			progname);
X		exit(2);
X	}
X	if (optind == argc-1)
X		status |= process(argv[optind], stdin, "stdin");
X	else {
X		int patind = optind;
X
X		for (optind++; optind < argc; optind++) {
X			in = efopen(argv[optind], "r");
X			status |= process(argv[patind], in, argv[optind]);
X			(void) fclose(in);
X		}
X	}
X	exit(status != 0? 0: 1);
X}
X
X/*
X * process - process input file
X */
Xprocess(pattern, in, inname)
Xchar *pattern;
XFILE *in;
Xchar *inname;
X{
X	int status = 0;
X	char line[BUFSIZ];
X
X	while (fgets(line, sizeof line, in) != NULL)
X		if (anchored)
X			status |= gngp(pattern, line);
X		else {
X			register char *start;
X
X			for (start = line; *start != '\0'; start++)
X				status |= gngp(pattern, start);
X		}
X	return status;
X}
X
Xint
Xgngp(pattern, text)
Xregister char *pattern, *text;
X{
X	int returned;
X	char savewhite;
X	char *whitesp;
X
X	if (anchored) {
X		extern char *strpbrk();
X
X		whitesp = strpbrk(text, " \t\n");
X		if (whitesp != NULL) {
X			savewhite = *whitesp;
X			*whitesp = '\0';
X		}
X	}
X	returned = ngmatch(pattern, text);
X	if (anchored) {
X		if (whitesp != NULL)
X			*whitesp = savewhite;
X	}
X	if (returned)
X		(void) fputs(text, stdout);
X	return returned;
X}
!
echo 'misc/newslock.c':
sed 's/^X//' >'misc/newslock.c' <<'!'
X/*
X * newslock - simple, unbroken version of ln(1) for shell-program locking
X *
X * (System V has broken ln(1) itself.)
X */
X#include <stdio.h>
X
Xmain(argc, argv)
Xint argc;
Xchar *argv[];
X{
X	if (argc != 3) {
X		fprintf(stderr, "Usage: %s tempname lockname\n", argv[0]);
X		exit(2);
X	}
X
X	if (link(argv[1], argv[2]) < 0)
X		exit(1);
X	else
X		exit(0);
X	/* NOTREACHED */
X}
!
echo 'misc/Makefile':
sed 's/^X//' >'misc/Makefile' <<'!'
XDEFS = # -Dvoid=int
XCOPTS = -O
XCFLAGS = $(DEFS) $(COPTS) -I../include
XLIBS = ../libcnews.a
XDBM = -ldbm
XLINTFLAGS = $(DEFS) -ha
XRN = ../relay
X# =()<NEWSBIN = @<NEWSBIN>@>()=
XNEWSBIN = /usr/lib/newsbin
X# workaround for System V make bug
XSHELL = /bin/sh
X
XMAINTBIN=newshist
XMAINT = $(MAINTBIN) newsdaily newswatch newsboot locknews addgroup delgroup
XUTILBIN = gngp newslock ctime getdate
XUTILS = $(UTILBIN) sizeof newshostname
XTHEM = $(MAINT) $(UTILS)
X
Xall:	$(THEM)
X
Xbins:	$(UTILBIN)
X
Xbininstall: $(THEM)
X	chmod +x $(THEM)
X	-if test ! -d $(NEWSBIN)/maint ; then mkdir $(NEWSBIN)/maint ; fi
X	cp $(MAINT) $(NEWSBIN)/maint
X	cp $(UTILS) $(NEWSBIN)
X
Xnewsinstall:
X	: nothing
X
Xgngp:	gngp.o $(LIBS)
X	$(CC) $(CFLAGS) gngp.o $(LIBS) -o $@
X
Xctime:	ctime.o $(LIBS)
X	$(CC) $(CFLAGS) ctime.o $(LIBS) -o $@
X
Xgetdate:	getdate.o $(LIBS)
X	$(CC) $(CFLAGS) getdate.o $(LIBS) -o $@
X
Xnewslock:	newslock.o $(LIBS)
X	$(CC) $(CFLAGS) newslock.o $(LIBS) -o $@
X
XNHCFLAGS = -I$(RN) $(CFLAGS)
XRNEWSOBJS = $(RN)/history.o $(RN)/article.o $(RN)/hdrcommon.o \
X $(RN)/io.o $(RN)/msgs.o
XNHLIBS = $(LIBS) $(DBM)
Xnewshist:	newshist.o $(RNEWSOBJS) $(LIBS)
X	$(CC) $(NHCFLAGS) newshist.o $(RNEWSOBJS) $(NHLIBS) -o $@
X
Xnewshist.o:	newshist.c
X	$(CC) $(NHCFLAGS) -c newshist.c
X
Xclean:
X	rm -f *.o $(MAINTBIN) $(UTILBIN)
!
echo 'misc/ctime.c':
sed 's/^X//' >'misc/ctime.c' <<'!'
X/*
X * ctime time_t ... - print the ascii time of time_t(s)
X */
X
X#include <stdio.h>
X#include <ctype.h>
X#include <time.h>
X#include <sys/types.h>
X#include <sys/timeb.h>
X
X#define	DAY	(24L*60L*60L)
X
Xstruct timeb ftnow;
X
Xchar *progname;
X
Xextern int errno;
Xextern char *strcpy();
Xextern char *strncpy();
Xextern char *strcat();
Xextern char *strchr();
Xextern char *strtok();
Xextern long atol();
Xextern char *malloc();
Xextern struct tm *gmtime();
Xextern time_t time();
X
X/* Forwards. */
Xextern void process();
X
X/*
X - main - parse arguments and handle options
X */
Xmain(argc, argv)
Xint argc;
Xchar *argv[];
X{
X	register int c;
X	register int errflg = 0;
X	extern int optind;
X	extern char *optarg;
X
X	progname = argv[0];
X	ftime(&ftnow);
X
X	while ((c = getopt(argc, argv, "")) != EOF)
X		switch (c) {
X		case '?':
X		default:
X			errflg++;
X			break;
X		}
X	if (errflg || optind == argc) {
X		(void) fprintf(stderr, "Usage: %s ascii_time ...\n", progname);
X		exit(2);
X	}
X
X	for (; optind < argc; optind++)
X		process(argv[optind]);
X	exit(0);
X}
X
X/*
X * process - print time_t of tm
X */
Xvoid
Xprocess(tms)
Xchar *tms;
X{
X	time_t tm;
X	char *ctime();
X	long atol();
X
X	tm = atol(tms);
X	(void) fputs(ctime(&tm), stdout);
X}
!
echo 'misc/newshist.c':
sed 's/^X//' >'misc/newshist.c' <<'!'
X/*
X * newshist msgids - print history lines corresponding to msgids
X */
X
X#include <stdio.h>
X#include "news.h"
X#include "history.h"
X
Xchar *progname;
Xint debug;
Xstatic char *histfile;		/* unused */
Xint remote;			/* to satisfy rnews code */
Xint headdebug = 0;		/* no debugging */
X
X/*
X * main - parse arguments and handle options
X */
Xmain(argc, argv)
Xint argc;
Xchar *argv[];
X{
X	int c;
X	int errflg = 0;
X	extern int optind;
X	extern char *optarg;
X
X	progname = argv[0];
X	while ((c = getopt(argc, argv, "df:")) != EOF)
X		switch (c) {
X		case 'd':
X			++debug;
X			break;
X		case 'f':
X			histfile = optarg;
X			break;
X		default:
X			errflg++;
X			break;
X		}
X	if (optind == argc || errflg) {
X		fprintf(stderr, "usage: %s [-df file] msgid ...\n", progname);
X		exit(2);
X	}
X
X	for (; optind < argc; optind++)
X		process(argv[optind]);
X	exit(0);
X}
X
X/*
X * process - message-id argument
X */
Xprocess(msgid)
Xchar *msgid;
X{
X	char *histent;
X
X	if (msgid == NULL)
X		return;		
X	histent = gethistory(msgid);
X	if (histent == NULL) {
X		char newmsgid[1000];
X		extern char *strcpy(), *strcat();
X
X		(void) strcpy(newmsgid, "<");
X		(void) strcat(newmsgid, msgid);
X		(void) strcat(newmsgid, ">");
X		histent = gethistory(newmsgid);
X	}
X	if (histent == NULL)
X		fprintf(stderr, "%s: no history entry for %s nor <%s>\n",
X			progname, msgid, msgid);
X	else
X		fputs(histent, stdout);
X	(void) fflush(stdout);
X}
X
Xunprivileged()
X{
X}
!
echo 'misc/getdate.c':
sed 's/^X//' >'misc/getdate.c' <<'!'
X/*
X * getdate ascii_time ... - print the time_t of ascii_time(s)
X */
X
X#include <stdio.h>
X#include <ctype.h>
X#include <time.h>
X#include <sys/types.h>
X#include <sys/timeb.h>
X
X#define	DAY	(24L*60L*60L)
X
Xstruct timeb ftnow;
X
Xchar *progname;
X
Xextern int errno;
Xextern char *strcpy();
Xextern char *strncpy();
Xextern char *strcat();
Xextern char *strchr();
Xextern char *strtok();
Xextern long atol();
Xextern char *malloc();
Xextern struct tm *gmtime();
Xextern time_t time();
X
Xextern time_t getdate();
X
X/* Forwards. */
Xextern void process();
X
X/*
X - main - parse arguments and handle options
X */
Xmain(argc, argv)
Xint argc;
Xchar *argv[];
X{
X	register int c;
X	register int errflg = 0;
X	extern int optind;
X	extern char *optarg;
X
X	progname = argv[0];
X	ftime(&ftnow);
X
X	while ((c = getopt(argc, argv, "")) != EOF)
X		switch (c) {
X		case '?':
X		default:
X			errflg++;
X			break;
X		}
X	if (errflg || optind == argc) {
X		(void) fprintf(stderr, "Usage: %s ascii_time ...\n", progname);
X		exit(2);
X	}
X
X	for (; optind < argc; optind++)
X		process(argv[optind]);
X	exit(0);
X}
X
X/*
X * process - print time_t of tm
X */
Xvoid
Xprocess(tm)
Xchar *tm;
X{
X	time_t it;
X
X	it = getdate(tm, &ftnow);
X	if (it < 0)
X		error("`%s' not valid date", tm);
X	else
X		(void) printf("%ld\n", it);
X}
!
echo 'misc/ctime.1':
sed 's/^X//' >'misc/ctime.1' <<'!'
X.TH CTIME 1 local
X.DA 23 April 1986
X.SH NAME
Xctime, getdate \- date conversions to and from numeric form
X.SH SYNOPSIS
X.B ctime
Xseconds ...
X.br
X.B getdate
Xdate ...
X.SH DESCRIPTION
X.I Ctime
Xconverts one or more Unix-internal (number of seconds since 1 Jan 1970)
Xdates into a human-readable form, as supplied by
X.IR ctime (3).
X.I Getdate
Xdoes the inverse, as done by
X.IR getdate (3).
X.PP
X.I Getdate
Xactually accepts a somewhat wider range of input than just output from
X.I ctime
Xor
X.IR date (1);
Xsee
X.IR getdate (3)
Xfor details.
XNote that each
X.I date
Xfed to
X.I getdate
Xmust be \fIone\fR argument;
Xit may be necessary to enclose it in quotes.
X.SH SEE ALSO
Xctime(3), getdate(3), date(1)
X.SH DIAGNOSTICS
X.I Getdate
Xwill object and exit with a status of 1 if it cannot make sense of a
X.IR date .
X.SH HISTORY
XSlightly-modified versions of programs written by Geoff Collyer at UTCS.
!
echo 'misc/README':
sed 's/^X//' >'misc/README' <<'!'
XThese are miscellaneous C News utilities which are used by more than one
Xsubsystem or aren't large enough to deserve their own directory.  newsaux(8)
Xdescribes most of them.
X
XCtime and getdate are, in our opinion, useful enough to deserve installing
Xin their own right, so we supply a manpage.
!
echo 'misc/newshostname':
sed 's/^X//' >'misc/newshostname' <<'!'
X#! /bin/sh
X# newshostname - print the hostname known to the news system
X# =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
X. ${NEWSCONFIG-/usr/lib/news/bin/config}
X# export NEWSCTL NEWSBIN NEWSARTS
X
XPATH=$NEWSCTL/bin:$NEWSBIN:$NEWSPATH ; export PATH
Xumask $NEWSUMASK
X
X# "test -r && cat" is used here instead of just "cat" because pre-v8
X# cat's are broken and return good status when they can't read their files.
X( (test -r $NEWSCTL/whoami && cat $NEWSCTL/whoami) || hostname ||
X	(test -r /etc/whoami && cat /etc/whoami) ||
X	uuname -l || uname -n || echo the_unknown_host) 2>/dev/null
!
echo 'misc/locknews':
sed 's/^X//' >'misc/locknews' <<'!'
X#! /bin/sh
X# lock the news system & arrange to unlock later
X# =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
X. ${NEWSCONFIG-/usr/lib/news/bin/config}
X
XPATH=$NEWSCTL/bin:$NEWSBIN:$NEWSPATH	# don't export it
Xumask $NEWSUMASK
X
Xcd $NEWSCTL
Xtrap : 1 2 3 15			# kids can be killed, but not me
Xif newslock sys LOCK; then
X	echo 'news system locked by you'
X	PS1="newslocked$PS1 " ${SHELL-/bin/sh}
X	rm -f LOCK
X	echo 'news system unlocked now'
Xelse
X	echo 'inadequate permissions, or news system already locked'
Xfi
!
echo 'misc/addgroup':
sed 's/^X//' >'misc/addgroup' <<'!'
X#! /bin/sh
X# addgroup - add a newsgroup, locally only
X
X# =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
X. ${NEWSCONFIG-/usr/lib/news/bin/config}
X
XPATH=$NEWSCTL/bin:$NEWSBIN/maint:$NEWSBIN/relay:$NEWSBIN:$NEWSPATH ; export PATH
Xumask $NEWSUMASK
X
Xusage="Usage: $0 groupname {y|n|m|x|=realgroup}"
X
Xcase $# in
X2)	;;
X*)	echo "$usage" >&2 ; exit 2	;;
Xesac
X
Xcase "$1" in
X*/*)	echo "$usage" >&2 ; exit 2	;;
Xesac
X
Xcase "$2" in
X[ynmx])	;;
X=*/*)	echo "$usage" >&2 ; exit 2	;;
X=*)	;;
X*)	echo "$usage" >&2 ; exit 2	;;
Xesac
X
Xalready="`sed 's/[ 	].*//' $NEWSCTL/active | fgrep -x \"$1\"`"
Xif test " $already" != " "
Xthen
X	echo "$0: $1 appears to exist already: \`$already'" >&2
X	exit 1
Xfi
X
Xlock="$NEWSCTL/LOCK"
Xltemp="$NEWSCTL/L.$$"
Xecho $$ >$ltemp
Xtrap "rm -f $ltemp ; exit 0" 0 1 2 15
Xwhile true
Xdo
X	if newslock $ltemp $lock
X	then
X		trap "rm -f $ltemp $lock ; exit 0" 0 1 2 15
X		break
X	fi
X	echo 'news system locked, waiting...'
X	sleep 5
Xdone
X
Xecho "$1 0000000000 0000000000 $2" >>$NEWSCTL/active
Xmkpdir $NEWSARTS/`echo $1 | tr . /`
X
XSENDER=${USER-unknown}@`hostname`
Xecho "$1 `getdate now` $SENDER" >>$NEWSCTL/active.times  # rn hook
Xecho "newsgroup $1 was created locally by $SENDER." | mail $NEWSMASTER
!
echo 'misc/delgroup':
sed 's/^X//' >'misc/delgroup' <<'!'
X#! /bin/sh
X# delgroup - delete a newsgroup, locally only
X
X# =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
X. ${NEWSCONFIG-/usr/lib/news/bin/config}
X
XPATH=$NEWSCTL/bin:$NEWSBIN/maint:$NEWSBIN:$NEWSPATH ; export PATH
Xumask $NEWSUMASK
X
Xusage="Usage: $0 groupname"
X
Xcase $# in
X1)	;;
X*)	echo "$usage" >&2 ; exit 2	;;
Xesac
X
Xcase "$1" in
X*/*)	echo "$usage" >&2 ; exit 2	;;
Xesac
X
Xalready="`sed 's/[ 	].*//' $NEWSCTL/active | fgrep -x \"$1\"`"
Xif test " $already" = " "
Xthen
X	echo "$0: $1 appears not to exist" >&2
X	exit 1
Xfi
X
Xlock="$NEWSCTL/LOCK"
Xltemp="$NEWSCTL/L.$$"
Xecho $$ >$ltemp
Xtrap "rm -f $ltemp ; exit 0" 0 1 2 15
Xwhile true
Xdo
X	if newslock $ltemp $lock
X	then
X		trap "rm -f $ltemp $lock ; exit 0" 0 1 2 15
X		break
X	fi
X	echo 'news system locked, waiting...'
X	sleep 5
Xdone
X
Xcd $NEWSCTL
X
Xawk "\$1 != \"$1\"" active >active.tmp
Xmv active active.old && mv active.tmp active
X
Xecho "You may wish to rm -rf $NEWSARTS/`echo "$1" | sed 's;\.;/;g'` at some point."
!
echo 'misc/sizeof':
sed 's/^X//' >'misc/sizeof' <<'!'
X#!/bin/sh
X# sizeof - report size of files, totalled
X
Xcase $# in
X0)	echo "Usage: sizeof file ..." >&2 ; exit 2 ;;
Xesac
X
Xls -ld $* 2>/dev/null | awk 'BEGIN { tot = 0 }
X	{
X		if (NF == 8)
X			tot += $4
X		else if (NF == 9)	# stupid clowns in AT&T changed format
X			tot += $5
X	}
X	END { print tot }'
!
echo 'misc/newswatch':
sed 's/^X//' >'misc/newswatch' <<'!'
X#! /bin/sh
X# newswatch - look for anomalies, notably locks present a long time
X
X# =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
X. ${NEWSCONFIG-/usr/lib/news/bin/config}
X
XPATH=$NEWSCTL/bin:$NEWSBIN/maint:$NEWSBIN:$NEWSPATH ; export PATH
Xumask $NEWSUMASK
X
Xif test $# -gt 0
Xthen
X	gurus="$*"
Xelse
X	gurus="$NEWSMASTER"
Xfi
X
Xcd $NEWSCTL
X
Xlocks="`echo LOCK*`"
Xif test -r watchtime -a " $locks" != " LOCK*"
Xthen
X	trouble="`find $locks ! -newer watchtime -print`"
X	if test " $trouble" != " "
X	then
X		ls -ldtr $trouble | mail $gurus
X	fi
Xfi
Xtouch watchtime
!
echo 'misc/newsdaily':
sed 's/^X//' >'misc/newsdaily' <<'!'
X#! /bin/sh
X# newsdaily - daily housekeeping chores
X
X# =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
X. ${NEWSCONFIG-/usr/lib/news/bin/config}
X
XPATH=$NEWSCTL/bin:$NEWSBIN/maint:$NEWSBIN:$NEWSPATH ; export PATH
Xumask $NEWSUMASK
X
Xgripes="/tmp/ngrip$$"
Xtmp="/tmp/ndai$$"
Xtrap "rm -f $gripes $tmp ; exit 0" 0 1 2 15
X>$gripes
X
Xif test $# -gt 0
Xthen
X	gurus="$*"
Xelse
X	gurus="$NEWSMASTER"
Xfi
X
Xcd $NEWSCTL
X
X# keep several generations of errlog for problem tracking
Xrm -f errlog.ooo
Xmv errlog.oo errlog.ooo
Xmv errlog.o errlog.oo
Xmv errlog errlog.o && >errlog
X
X# keep one generation of log -- it's big
Xrm log.o
Xmv log log.o && >log
X
X# report any errors
Xsleep 500			# hope that log.o is quiescent after this
Xif test -s errlog.o
Xthen
X	(
X		echo "errlog.o"
X		echo ---------
X		cat errlog.o
X		echo ---------
X		echo
X	) >>$gripes
Xfi
X
X# look for input anomalies
Xcd $NEWSARTS/in.coming
Xthem="`ls | egrep -v '^bad$'`"
Xif test " $them" != " "
Xthen
X	find $them -mtime +1 -print >$tmp	# old non-bad files lying about
X	if test -s $tmp
X	then
X		(
X			echo 'old input files:'
X			cat $tmp
X			echo
X		) >>$gripes
X	fi
Xfi
Xfind bad -type f -mtime -2 -print >$tmp		# recent bad batches
Xif test -s $tmp
Xthen
X	(
X		echo 'recent bad input batches:'
X		cat $tmp
X		echo
X	) >>$gripes
Xfi
Xfind bad -type f -mtime +7 -exec rm -f '{}' ';'
X
X# look for output anomalies
Xcd $NEWSARTS/out.going
Xfind * -type f -name 'togo*' -size +0 -mtime +1 -print >$tmp
Xif test -s $tmp
Xthen
X	(
X		echo 'batching possibly stalled for sites:'
X		sed 's;/.*;;' $tmp | sort -u
X		echo
X	) >>$gripes
Xfi
X
X# and send it
Xif test -s $gripes
Xthen
X	mail $gurus <$gripes
Xfi
!
echo 'misc/newsboot':
sed 's/^X//' >'misc/newsboot' <<'!'
X#! /bin/sh
X# newsboot - clean up on reboot
X
X# =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
X. ${NEWSCONFIG-/usr/lib/news/bin/config}
X
XPATH=$NEWSCTL/bin:$NEWSBIN:$NEWSPATH ; export PATH
Xumask $NEWSUMASK
X
Xcd $NEWSCTL
Xrm -f L.* LOCK*				# leftover locks
Xrm -f history.n*			# leftover expire work files
X
Xcd $NEWSARTS/in.coming
Xrm -f nspool.* nruntmp.*		# leftover temporaries
Xfor f in nntp.*				# find partial batches
Xdo
X	while test -f $f		# still there?
X	do
X		name=`getdate now`
X		if test ! -f $name
X		then
X			mv $f $name
X		else
X			sleep 2
X		fi
X	done
Xdone
!
echo 'nntpdiffs/README':
sed 's/^X//' >'nntpdiffs/README' <<'!'
XC news diffs for NNTP 1.5 server directory.  Geoff Collyer, 8 June 1989
X
Xdiff contains normal diffs against 1.5.
Xcdiff.1.5.0 is equivalent context diffs against 1.5;
Xcdiff.1.5.5 is context diffs against 1.5.5.
XContext diffs are courtesy Jean-Francois Lamy.
X
Xsrc contains the resultant changed 1.5 source.
Xsrc.allnew contains entirely new source files.
X
XThe changes to misc.c and newnews.c have not been tested.
XThe other changes have been tested and make a large difference to
Xperformance.
!
echo 'nntpdiffs/diff/ihave.c':
sed 's/^X//' >'nntpdiffs/diff/ihave.c' <<'!'
X46c46,52
X< 	retcode = spawn(rnews, "rnews", (char *) 0, CONT_XFER, ERR_XFERFAIL, errbuf);
X---
X> #ifdef UNBATCHED_INPUT
X> 	retcode = spawn(rnews, "rnews", (char *) 0, CONT_XFER,
X> 		ERR_XFERFAIL, errbuf);
X> #else
X> 	/* C news input hook */
X> 	retcode = batch_input_article(CONT_XFER, ERR_XFERFAIL, errbuf);
X> #endif
!
echo 'nntpdiffs/diff/misc.c':
sed 's/^X//' >'nntpdiffs/diff/misc.c' <<'!'
X85d84
X<  *			Converts "msg_id" to lower case.
X118,121d116
X< 
X< 	for (cp = msg_id; *cp != '\0'; ++cp)
X< 		if (isupper(*cp))
X< 			*cp = tolower(*cp);
!
echo 'nntpdiffs/diff/newnews.c':
sed 's/^X//' >'nntpdiffs/diff/newnews.c' <<'!'
X258c258
X< seekuntil(fp, key, line, linesize)
X---
X> seekuntil(fp, akey, line, linesize)
X260c260
X< 	char		*key;
X---
X> 	char		*akey;
X266a267,268
X> 	extern long dtol();
X> 	char key[30];
X267a270
X> 	(void) sprintf(key, "%ld", dtol(akey));	/* akey -> time_t in ascii */
X329a333,335
X> /*
X>  * C news version of getword.
X>  */
X336a343
X> 	extern char *index();
X340,366c347,359
X< 	if (cp = index(line, '\t')) {
X< /*
X<  * The following gross hack is present because the history file date
X<  * format is braindamaged.  They like "mm/dd/yy hh:mm", which is useless
X<  * for relative comparisons of dates using something like atoi() or
X<  * strcmp.  So, this changes their format into yymmddhhmm.  Sigh.
X<  *
X<  * 12345678901234	("x" for cp[x])
X<  * mm/dd/yy hh:mm 	(their lousy representation)
X<  * yymmddhhmm		(our good one)
X<  * 0123456789		("x" for w[x])
X<  */
X< 		*cp = '\0';
X< 		(void) strncpy(w, cp+1, 15);
X< 		w[0] = cp[7];		/* Years */
X< 		w[1] = cp[8];
X< 		w[2] = cp[1];		/* Months */
X< 		w[3] = cp[2];
X< 		w[4] = cp[4];		/* Days */
X< 		w[5] = cp[5];
X< 		w[6] = cp[10];		/* Hours */
X< 		w[7] = cp[11];
X< 		w[8] = cp[13];		/* Minutes */
X< 		w[9] = cp[14];
X< 		w[10] = '\0';
X< 	} else
X< 		w[0] = '\0';
X---
X> 	w[0] = '\0';				/* in case of bad format */
X> 	if (cp = index(line, '\t')) {		/* find 2nd field */
X> 		register char *endp;
X> 
X> 		*cp++ = '\0';
X> 		endp = index(cp, '~');		/* end of date-received */
X> 		if (endp == NULL)
X> 			endp = index(cp, '\t');	/* end of expiry */
X> 		if (endp != NULL) {
X> 			(void) strncpy(w, cp, endp - cp);
X> 			w[endp - cp] = '\0';
X> 		}
X> 	}
!
echo 'nntpdiffs/diff/serve.c':
sed 's/^X//' >'nntpdiffs/diff/serve.c' <<'!'
X239a240,242
X> #ifndef UNBATCHED_INPUT
X> 	{
X> 		char errbuf[2 * NNTP_STRLEN];
X240a244,246
X> 		enqpartbatch(CONT_XFER, ERR_XFERFAIL, errbuf);
X> 	}
X> #endif
X241a248
X> 
X290d296
X< 
!
echo 'nntpdiffs/src/Makefile':
sed 's/^X//' >'nntpdiffs/src/Makefile' <<'!'
X#
X# Makefile for NNTP server
X#
X
XSRVROBJ = main.o serve.o access.o access_inet.o access_dnet.o active.o \
X	batch.o \
X	ahbs.o globals.o group.o help.o ihave.o list.o misc.o netaux.o \
X	newgroups.o newnews.o nextlast.o ngmatch.o post.o parsit.o scandir.o \
X	slave.o spawn.o strcasecmp.o subnet.o time.o xhdr.o fakesyslog.o \
X	../common/version.o
X
XSRVRSRC = main.c serve.c access.c access_inet.c access_dnet.c active.c \
X	batch.c \
X	ahbs.c globals.c group.c help.c ihave.c list.c misc.c netaux.c \
X	newgroups.c newnews.c nextlast.c ngmatch.c post.c parsit.c scandir.c \
X	slave.c spawn.c strcasecmp.c subnet.c time.c xhdr.c fakesyslog.c \
X	../common/version.c
X
XSRVRINC = common.h ../common/conf.h ../common/nntp.h
X
XSRCS	= ${SRVRSRC}
X
X# -ldbm here if you've #define'ed DBM in ../common/conf.h
XLIBS	= -ldbm
X
XCFLAGS	= -O
X
X# Where nntpd is going to live
X
XDESTDIR	= /etc
X
Xall:	nntpd
X
Xnntpd: ${SRVROBJ} ${SRVRINC}
X	${CC} ${CFLAGS} -o nntpd ${SRVROBJ} ${LIBS}
X
X${SRVROBJ}: ${SRVRINC}
X
Xinstall: nntpd
X	cp nntpd ${DESTDIR}/nntpd
X	chmod 711 ${DESTDIR}/nntpd
X
Xlint:
X	lint ${SRVRSRC}
X
Xclean:
X	-rm -f *.o nntpd make*.out a.out
X
Xdistrib: clean
X	rm -rf SCCS save tags
X
Xcheck:
X	sccs check
X	sccs prt -y *.[ch] > /dev/null
X
Xtags:	${SRVRSRC} ${SRVRINC}
X	ctags ${SRVRSRC} ${SRVRINC}
X
X# Dependencies
X
X../common/version.o:
X	${CC} ${CFLAGS} -c ../common/version.c
X	mv version.o ../common/version.o
!
echo 'nntpdiffs/src/ihave.c':
sed 's/^X//' >'nntpdiffs/src/ihave.c' <<'!'
X#ifndef lint
Xstatic char	*sccsid = "@(#)ihave.c	1.11	(Berkeley) 1/11/88";
X#endif
X
X#include "common.h"
X
X#ifdef LOG
Xint	ih_accepted;
Xint	ih_rejected;
Xint	ih_failed;
X#endif LOG
X
X/*
X * IHAVE <messageid>
X *
X * Accept an article for transferral if we haven't seen it before.
X */
X
Xihave(argc, argv)
X	int		argc;
X	char		*argv[];
X{
X	char		errbuf[2 * NNTP_STRLEN];
X	int		retcode;
X	register char	*cp;
X
X	if (argc != 2) {
X		printf("%d Usage: IHAVE <message-id>.\r\n", ERR_CMDSYN);
X		(void) fflush(stdout);
X		return;
X	}
X
X	cp = gethistent(argv[1]);
X	if (cp != NULL) {
X		printf("%d Got it.\r\n", ERR_GOTIT);
X		(void) fflush(stdout);
X#ifdef LOG
X		ih_rejected++;
X#ifdef IHAVE_DEBUG
X		syslog(LOG_DEBUG, "%s ihave %s rejected", hostname, argv[1]);
X#endif IHAVE_DEBUG
X#endif LOG
X		return;
X	}
X		
X#ifdef UNBATCHED_INPUT
X	retcode = spawn(rnews, "rnews", (char *) 0, CONT_XFER,
X		ERR_XFERFAIL, errbuf);
X#else
X	/* C news input hook */
X	retcode = batch_input_article(CONT_XFER, ERR_XFERFAIL, errbuf);
X#endif
X	if (retcode <= 0)
X		printf("%d %s\r\n", ERR_XFERFAIL, errbuf);
X	else if (retcode > 0)
X		printf("%d Thanks.\r\n",
X			OK_XFERED);
X	(void) fflush(stdout);
X
X#ifdef LOG
X	if (retcode == 1)
X		ih_accepted++;
X	else
X		ih_failed++;
X		
X#ifdef IHAVE_DEBUG
X	syslog(LOG_DEBUG, "%s ihave %s accepted %s",
X		hostname, argv[1], retcode == 1 ? "succeeded" : "failed");
X#endif IHAVE_DEBUG
X#endif LOG
X
X}
!
echo done


-- 
Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.
Use a domain-based address or give alternate paths, or you may lose out.