BSD 4_4_Lite1 development
authorCSRG <csrg@ucbvax.Berkeley.EDU>
Mon, 7 Jun 1993 05:04:52 +0000 (21:04 -0800)
committerCSRG <csrg@ucbvax.Berkeley.EDU>
Mon, 7 Jun 1993 05:04:52 +0000 (21:04 -0800)
Work on file usr/src/contrib/news/inn/doc/active.5
Work on file usr/src/contrib/news/inn/doc/buffchan.8
Work on file usr/src/contrib/news/inn/doc/batcher.8
Work on file usr/src/contrib/news/inn/doc/cvtbatch.8
Work on file usr/src/contrib/news/inn/doc/control.ctl.5
Work on file usr/src/contrib/news/inn/doc/ctlinnd.8
Work on file usr/src/contrib/news/inn/doc/expire.8
Work on file usr/src/contrib/news/inn/doc/distrib.pats.5
Work on file usr/src/contrib/news/inn/doc/expire.ctl.5
Work on file usr/src/contrib/news/inn/doc/expireover.8
Work on file usr/src/contrib/news/inn/doc/getlist.1
Work on file usr/src/contrib/news/inn/doc/filechan.8
Work on file usr/src/contrib/news/inn/doc/history.5
Work on file usr/src/contrib/news/inn/doc/hosts.nntp.5
Work on file usr/src/contrib/news/inn/doc/inn.conf.5
Work on file usr/src/contrib/news/inn/doc/inews.1
Work on file usr/src/contrib/news/inn/doc/innwatch.ctl.5
Work on file usr/src/contrib/news/inn/doc/innxmit.8
Work on file usr/src/contrib/news/inn/doc/moderators.5
Work on file usr/src/contrib/news/inn/doc/libinn.3
Work on file usr/src/contrib/news/inn/doc/news-recovery.8
Work on file usr/src/contrib/news/inn/doc/news.daily.8
Work on file usr/src/contrib/news/inn/doc/overview.fmt.5
Work on file usr/src/contrib/news/inn/doc/nnrp.access.5
Work on file usr/src/contrib/news/inn/doc/nntpsend.8
Work on file usr/src/contrib/news/inn/doc/nntpsend.ctl.5
Work on file usr/src/contrib/news/inn/doc/prunehistory.8
Work on file usr/src/contrib/news/inn/doc/passwd.nntp.5
Work on file usr/src/contrib/news/inn/doc/shlock.1
Work on file usr/src/contrib/news/inn/doc/rnews.1
Work on file usr/src/contrib/news/inn/include/logging.h
Work on file usr/src/contrib/news/inn/include/macros.h
Work on file usr/src/contrib/news/inn/samples/checkgroups
Work on file usr/src/contrib/news/inn/samples/ctlrun
Work on file usr/src/contrib/news/inn/samples/docheckgroups
Work on file usr/src/contrib/news/inn/samples/default
Work on file usr/src/contrib/news/inn/samples/expirerm
Work on file usr/src/contrib/news/inn/samples/ihave
Work on file usr/src/contrib/news/inn/samples/innstat
Work on file usr/src/contrib/news/inn/samples/innwatch
Work on file usr/src/contrib/news/inn/samples/innwatch.ctl
Work on file usr/src/contrib/news/inn/samples/makegroup
Work on file usr/src/contrib/news/inn/samples/news.daily
Work on file usr/src/contrib/news/inn/samples/newgroup
Work on file usr/src/contrib/news/inn/samples/nntpsend
Work on file usr/src/contrib/news/inn/samples/parsecontrol
Work on file usr/src/contrib/news/inn/samples/rmgroup
Work on file usr/src/contrib/news/inn/samples/rc.news
Work on file usr/src/contrib/news/inn/samples/send-ihave
Work on file usr/src/contrib/news/inn/samples/send-nntp
Work on file usr/src/contrib/news/inn/samples/scanlogs
Work on file usr/src/contrib/news/inn/samples/send-uucp
Work on file usr/src/contrib/news/inn/samples/sendme
Work on file usr/src/contrib/news/inn/samples/sendsys
Work on file usr/src/contrib/news/inn/samples/sendbatch
Work on file usr/src/contrib/news/inn/samples/senduuname
Work on file usr/src/contrib/news/inn/samples/writelog
Work on file usr/src/contrib/news/inn/samples/tally.control
Work on file usr/src/contrib/news/inn/samples/version
Work on file usr/src/contrib/news/inn/samples/tally.unwanted
Work on file usr/src/contrib/news/inn/syslog/syslog.conf

Synthesized-from: CSRG/cd2/4.4BSD-Lite1

61 files changed:
usr/src/contrib/news/inn/doc/active.5 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/batcher.8 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/buffchan.8 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/control.ctl.5 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/ctlinnd.8 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/cvtbatch.8 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/distrib.pats.5 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/expire.8 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/expire.ctl.5 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/expireover.8 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/filechan.8 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/getlist.1 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/history.5 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/hosts.nntp.5 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/inews.1 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/inn.conf.5 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/innwatch.ctl.5 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/innxmit.8 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/libinn.3 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/moderators.5 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/news-recovery.8 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/news.daily.8 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/nnrp.access.5 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/nntpsend.8 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/nntpsend.ctl.5 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/overview.fmt.5 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/passwd.nntp.5 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/prunehistory.8 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/rnews.1 [new file with mode: 0644]
usr/src/contrib/news/inn/doc/shlock.1 [new file with mode: 0644]
usr/src/contrib/news/inn/include/logging.h [new file with mode: 0644]
usr/src/contrib/news/inn/include/macros.h [new file with mode: 0644]
usr/src/contrib/news/inn/samples/checkgroups [new file with mode: 0644]
usr/src/contrib/news/inn/samples/ctlrun [new file with mode: 0644]
usr/src/contrib/news/inn/samples/default [new file with mode: 0644]
usr/src/contrib/news/inn/samples/docheckgroups [new file with mode: 0644]
usr/src/contrib/news/inn/samples/expirerm [new file with mode: 0644]
usr/src/contrib/news/inn/samples/ihave [new file with mode: 0644]
usr/src/contrib/news/inn/samples/innstat [new file with mode: 0644]
usr/src/contrib/news/inn/samples/innwatch [new file with mode: 0644]
usr/src/contrib/news/inn/samples/innwatch.ctl [new file with mode: 0644]
usr/src/contrib/news/inn/samples/makegroup [new file with mode: 0644]
usr/src/contrib/news/inn/samples/newgroup [new file with mode: 0644]
usr/src/contrib/news/inn/samples/news.daily [new file with mode: 0644]
usr/src/contrib/news/inn/samples/nntpsend [new file with mode: 0644]
usr/src/contrib/news/inn/samples/parsecontrol [new file with mode: 0644]
usr/src/contrib/news/inn/samples/rc.news [new file with mode: 0644]
usr/src/contrib/news/inn/samples/rmgroup [new file with mode: 0644]
usr/src/contrib/news/inn/samples/scanlogs [new file with mode: 0644]
usr/src/contrib/news/inn/samples/send-ihave [new file with mode: 0644]
usr/src/contrib/news/inn/samples/send-nntp [new file with mode: 0644]
usr/src/contrib/news/inn/samples/send-uucp [new file with mode: 0644]
usr/src/contrib/news/inn/samples/sendbatch [new file with mode: 0644]
usr/src/contrib/news/inn/samples/sendme [new file with mode: 0644]
usr/src/contrib/news/inn/samples/sendsys [new file with mode: 0644]
usr/src/contrib/news/inn/samples/senduuname [new file with mode: 0644]
usr/src/contrib/news/inn/samples/tally.control [new file with mode: 0644]
usr/src/contrib/news/inn/samples/tally.unwanted [new file with mode: 0644]
usr/src/contrib/news/inn/samples/version [new file with mode: 0644]
usr/src/contrib/news/inn/samples/writelog [new file with mode: 0644]
usr/src/contrib/news/inn/syslog/syslog.conf [new file with mode: 0644]

diff --git a/usr/src/contrib/news/inn/doc/active.5 b/usr/src/contrib/news/inn/doc/active.5
new file mode 100644 (file)
index 0000000..2573150
--- /dev/null
@@ -0,0 +1,113 @@
+.\" $Revision: 1.10 $
+.TH ACTIVE 5
+.SH NAME
+active, active.times \- list of active Usenet newsgroups
+.SH DESCRIPTION
+The file
+.\" =()<.I @<_PATH_ACTIVE>@>()=
+.I /var/spool/news/data/active
+lists the newsgroups that the local site receives.
+Each newsgroup should be listed only once.
+Each line specifies one group; their order in the file does not matter.
+Within each newsgroup, articles are assigned unique names, which are
+monotonically increasing numbers.
+.PP
+If an article is posted to newsgroups not mentioned in this file, those
+newsgroups are ignored.
+If no valid newsgroups are specified, the article is
+.\" =()<.ie '@<WANT_TRASH>@'DONT' rejected.>()=
+.ie 'DONT'DONT' rejected.
+.el \{\
+filed into the newsgroup ``junk'' and only propagated to sites that receive
+the ``junk'' newsgroup.\}
+.PP
+Each line consists of four fields specified by a space:
+.RS
+.nf
+name himark lomark flags
+.fi
+.RE
+The first field is the name of the newsgroup.
+.\" =()<.if '@<MERGE_TO_GROUPS>@'DO' \{\>()=
+.if 'DONT'DO' \{\
+Newsgroups that start with the three characters ``to.'' are treated
+specially; see
+.IR innd (8).\}
+The second field is the highest article number that has been used in that
+newsgroup.
+The third field is the lowest article number in the group; this number
+is not guaranteed to be accurate, and should only be taken to be a hint.
+Note that because of article cancellations, there may be gaps in the
+numbering sequence.
+If the lowest article number is greater then the highest article number,
+then there are no articles in the newsgroup.
+In order to make it possible to update an entry in-place without rewriting
+the entire file, the second and third fields are padded out with leading
+zeros to make them a fixed width.
+.PP
+The fourth field can contain one of the following flags:
+.RS
+.nf
+.ta \w'=foo.bar   'u
+y      Local postings are allowed
+n      No local postings are allowed, only remote ones
+m      The group is moderated and all postings must be approved
+j      Articles in this group are not kept, but only passed on
+x      Articles cannot be posted to this newsgroup
+=foo.bar       Articles are locally filed into the ``foo.bar'' group
+.fi
+.RE
+.PP
+If a newsgroup has the ``j'' flag, then no articles will be filed into
+that newsgroup and local postings to that group should not be generated.
+If an article for such a newsgroup is received from a remote site, it
+will be filed into the ``junk'' newsgroup if it is not cross-posted.
+This is different from not having a newsgroup listed in the file because
+sites can subscribe to ``j'' newsgroups and the article will be propagated
+to them.
+.PP
+If the fourth field of a newsgroup starts with an equal sign, then
+the newsgroup is an alias.
+Articles can be posted to the group, but will be treated as if they
+were posted to the group named after the equal sign.
+The second and third fields are ignored.
+Note that the Newsgroup header is not modified
+(Alias groups are typically used during a transition, and are typically
+created with
+.IR ctlinnd (8)).
+An alias newsgroup should not point to another alias.
+.PP
+The file
+.\" =()<.I @<_PATH_ACTIVETIMES>@>()=
+.I /var/spool/news/data/active.times
+provides a chronological record of when newsgroups are created.
+This file is normally updated by
+.IR innd (8)
+whenever a
+.I ctlinnd
+\&``newgroup'' command is done.
+Each line consist of three fields:
+.RS
+.nf
+name time creator
+.fi
+.RE
+.PP
+The first field is the name of the newsgroup.
+The second field is the time it was created, expressed as the number of
+seconds since the epoch \(em
+.IR i.e. ,
+a
+.IR time_t ;
+see
+.IR gettimeofday (2).
+The third field is the electronic mail address of the person who
+created the group.
+.SH HISTORY
+Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: active.5,v 1.10 1993/01/29 16:42:32 rsalz Exp $
+.SH "SEE ALSO"
+ctlinnd(8), innd(8).
diff --git a/usr/src/contrib/news/inn/doc/batcher.8 b/usr/src/contrib/news/inn/doc/batcher.8
new file mode 100644 (file)
index 0000000..27a6df0
--- /dev/null
@@ -0,0 +1,178 @@
+.\" $Revision: 1.13 $
+.TH BATCHER 8
+.SH NAME
+batcher \- article batching backend for InterNetNews
+.SH SYNOPSIS
+.B batcher
+[
+.BI \-a " arts"
+]
+[
+.BI \-A " total_arts"
+]
+[
+.BI \-b " size"
+]
+[
+.BI \-B " total_size"
+]
+[
+.BI \-i " string"
+]
+[
+.BI \-N " num_batches"
+]
+[
+.BI \-p " process"
+]
+[
+.B \-r
+]
+[
+.BI \-s " separator"
+]
+[
+.BI \-S " alt_spool"
+]
+[
+.B \-v
+]
+.I host
+[
+.I input
+]
+.SH DESCRIPTION
+.I Batcher
+reads uses a list of files to prepare news batches for the specified
+.IR host .
+It is normally invoked by a script run out of
+.IR cron (8)
+that uses
+.IR shlock (1)
+to lock the host name, followed by a
+.IR ctlinnd (8)
+command to flush the batchfile.
+.PP
+.I Batcher
+reads the named
+.I input
+file, or standard input if no file is given.
+Relative pathnames are interpreted from the
+.\" =()<.I @<_PATH_BATCHDIR>@>()=
+.I /var/spool/news/out.going
+directory.
+The input is taken as a set of lines.
+Blank lines and lines starting with a number sign (``#'') are ignored.
+All other lines should consist of one or two fields separated by a single space.
+The first field is the name of a file holding an article; if it is not an
+an absolute pathname it is taken relative to the news spool directory,
+.\" =()<.IR @<_PATH_SPOOL>@ .>()=
+.IR /var/spool/news/spool .
+The second field, if present, specifies the size of the article in bytes.
+.PP
+The ``\-S'' flag may be used to specify an alternate spool directory to
+use if the article is not found; this would normally be an NFS-mounted
+spool directory of a master server with longer expiration times.
+.PP
+By default, the program sets its standard error to
+.\" =()<.IR @<_PATH_ERRLOG>@ .>()=
+.IR /var/spool/news/data/errlog .
+To suppress this redirection, use the ``\-r'' flag.
+Upon exit,
+.I batcher
+reports statistics via
+.IR syslog (3).
+If the ``\-v'' flag is used, they will also be printed on the standard
+output.
+.PP
+.I Batcher
+collects the text of the named articles into batches.
+To limit the size of each batch, use the ``\-b'' flag.
+The default size is 60 kilobytes.
+Using ``\-b0'' allows unlimited batch sizes.
+To limit the number of articles in each batch, use the ``\-a'' flag.
+The default is no limit.
+A new batch will be started when either the byte count or number of
+articles written exceeds the specified limits.
+.PP
+To limit the total number of bytes written for all batches, use the ``\-B''
+flag.
+To limit the total number of articles that can be batched use the ``\-A''
+flag.
+To limit the total number of batches that should be created use the ``\-N''
+flag.
+In all three cases, the default is zero, which is taken to mean no limit.
+.PP
+A batch starts with an identifying line to specify the unpacking method
+to be used on the receiving end.
+When the ``\-i'' flag is used, the initial string,
+.IR string ,
+followed by a newline, will be output at the start of every batch.
+The default is to have no initial string.
+.PP
+Each article starts with a separator line to indicate the size of the article.
+To specify the separator use the ``\-s'' flag.
+This is a
+.IR sprintf (3)
+format string which can have a single ``%ld'' parameter which will be given
+the size of the article.
+If the separator is not empty, then the string and a newline will be output
+before every article.
+The default separator is ``#! rnews %ld''.
+.PP
+By default, batches are written to standard output, which
+is not useful when more than one output batch is created.
+Use the ``\-p'' flag to specify the shell command that should be
+created (via
+.IR popen (3))
+whenever a new batch is started.
+The process is a
+.I sprintf
+format string which can have a single ``%s'' parameter which will be given
+the host name.
+A common value is:
+.RS
+.nf
+( echo '#! cunbatch' ; exec compress ) | uux \- \-r \-z %s!rnews
+.fi
+.RE
+.PP
+If the input is exhausted,
+.I batcher
+will exit with a zero status.
+If any of the limits specified with the ``\-B,'' ``\-A,'' or ``\-N'' flags
+is reached, or if there is an error writing the batch, then
+.I batcher
+will try to spool the input, copying it to a file.
+If there was no input filename, the standard input will be copied to
+.\" =()<.IR @<_PATH_BATCHDIR>@/ host>()=
+.IR /var/spool/news/out.going/ host
+and the program will exit.
+If an input filename was given, a temporary file named
+.IR input .bch
+(if
+.I input
+is an absolute pathname)
+or
+.\" =()<.IR @<_PATH_BATCHDIR>@/ input.bch>()=
+.IR /var/spool/news/out.going/ input.bch
+(if the filename does not begin with a slash) is created.
+Once the input is copied,
+.I batcher
+will try to rename this temporary file to be the name of the input file,
+and then exit.
+.PP
+Upon receipt of an interrupt or termination signal,
+.I batcher
+will finish sending the current article, close the batch, and then
+rewrite the batchfile according as described in the previous paragraph.
+.SH HISTORY
+Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: batcher.8,v 1.13 1992/09/14 19:21:00 rsalz Exp $
+.SH "SEE ALSO"
+ctlinnd(8),
+newsfeeds(5),
+shlock(1).
diff --git a/usr/src/contrib/news/inn/doc/buffchan.8 b/usr/src/contrib/news/inn/doc/buffchan.8
new file mode 100644 (file)
index 0000000..3920972
--- /dev/null
@@ -0,0 +1,183 @@
+.\" $Revision: 1.7 $
+.TH BUFFCHAN 8
+.SH NAME
+buffchan \- buffered file-writing backend for InterNetNews
+.SH SYNOPSIS
+.B buffchan
+[
+.B \-b
+]
+[
+.BI \-c " lines"
+]
+[
+.BI \-C " seconds"
+]
+[
+.BI \-d " directory"
+]
+[
+.BI \-f " fields"
+]
+[
+.BI \-m " map"
+]
+[
+.BI \-p " pidfile"
+]
+[
+.BI \-l " lines"
+]
+[
+.BI \-L " seconds"
+]
+[
+.B \-r
+]
+[
+.BI \-s " file_format"
+]
+[
+.B \-u
+]
+.SH DESCRIPTION
+.I Buffchan
+reads lines from standard input and copies certain fields in
+each line into files named by other fields within the line.
+.I Buffchan
+is intended to be called by
+.IR innd (8)
+as an exploder feed.
+.PP
+.I Buffchan
+input is interpreted as a set of lines.
+Each line contains a fixed number of initial fields, followed by a
+variable number of filename fields.
+All fields in a line are separated by whitespace.
+The default number of initial fields is one; the ``\-f'' flag may be
+used to specify a different number of fields.
+See
+.IR filechan (8)
+for an example.
+.PP
+After the initial fields, each remaining field names a file to
+write.
+The ``-s'' flag may be used to specify a format string that maps
+the field to a file name.
+This is a
+.IR sprintf (3)
+format string which should have a single ``%s'' parameter which will be given
+the field.
+The default value is
+.\" =()<.IR @<_PATH_BATCHDIR>@/ %s.>()=
+.IR /var/spool/news/out.going/ %s.
+See the description of this flag in
+.IR filechan (8).
+The ``\-d'' flag may be used to specify a directory the program should
+change to before starting.
+If this flag is used, then the default for the ``\-s'' flag is changed to
+be a simple ``%s.''
+.PP
+Once
+.I buffchan
+opens a file it keeps it open.
+The input must therefore never specify more files than can the
+number of available descriptors can keep open.
+If the ``\-b'' flag is used, the program will allocate a buffer and
+attach it to the file using
+.IR setbuf (3).
+If the ``\-u'' flag is used, the program will request unbuffered output.
+.PP
+If the ``\-l'' flag is used with a number
+.IR n ,
+then
+.I buffchan
+will call
+.IR fflush (3)
+after every
+.I n
+lines are written to a file.
+If the ``\-c'' flag is used with a number
+.IR n ,
+then
+.I buffchan
+will close, and re-open, a file after every
+.I n
+lines are written to a file.
+.PP
+If the ``\-L'' flag is used with a number
+.IR n ,
+then all files will be flushed every
+.I n
+seconds.
+Similarly, the ``\-C'' flag may be used to specify that all files should
+be closed and re-opened every
+.I n
+seconds.
+.PP
+By default, the program sets its standard error to
+.\" =()<.IR @<_PATH_ERRLOG>@ .>()=
+.IR /var/spool/news/data/errlog .
+To suppress this redirection, use the ``\-r'' flag.
+.PP
+If the ``\-p'' flag is used, the program will write a line containing
+its process ID (in text) to the specified file.
+.PP
+.I Buffchan
+can be invoked as an exploder feed (see
+.IR newsfeeds (5)).
+As such, if a line starts with an exclamation point it will be treated
+as a command.
+There are three commands, described below:
+.TP
+.B flush
+The ``flush'' command closes and re-opens
+all open files; ``flush\ xxx'' which flushes only the specified site.
+These are analogous to the
+.IR ctlinnd (8)
+\&``flush'' command, 
+and can be achieved by doing a ``send\ "flush\ xxx"'' command.
+Applications can tell that the ``flush'' has completed by renaming the
+file before issuing the command;
+.I buffchan
+has completed the command when the original filename re-appears.
+.\" =()<.if '@<HAVE_FCHMOD>@'DO' \{\>()=
+.if 'DO'DO' \{\
+.PP
+.I Buffchan
+also changes the access permissions of the file from read-only for
+everyone to read-write for owner and group as it flushes or closes each
+output file.
+It will change the modes back to read-only if it re-opens the same file.\}
+.PP
+.B drop
+The ``drop'' command is similar to the ``flush'' command except that any
+files are not re-opened.
+If given an argument, then the specified site is dropped, otherwise all
+sites are dropped.
+(Note that the site will be restarted if the input stream mentions the
+site.)
+When a
+.I ctlinnd
+\&``drop site'' command is sent,
+.I innd
+will automatically forward the command to
+.I buffchan
+if the site is a funnel that feeds into this exploder.
+To drop all sites, use the
+.I ctlinnd
+\&``send buffchan-site drop'' command.
+.TP
+.B readmap
+The map file (specified with the ``\-m'' flag) is reloaded.
+.SH HISTORY
+Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: buffchan.8,v 1.7 1993/03/18 21:03:33 rsalz Exp $
+.SH "SEE ALSO"
+ctlinnd(8),
+filechan(8),
+innd(8),
+newsfeeds(5).
diff --git a/usr/src/contrib/news/inn/doc/control.ctl.5 b/usr/src/contrib/news/inn/doc/control.ctl.5
new file mode 100644 (file)
index 0000000..d3d0eff
--- /dev/null
@@ -0,0 +1,125 @@
+.\" $Revision: 1.4 $
+.TH CONTROL.CTL 5
+.SH NAME
+control.ctl \- specify handling of Usenet control messages
+.SH DESCRIPTION
+The file
+.\" =()<.I @<_PATH_CONTROLCTL>@>()=
+.I /var/spool/news/data/control.ctl
+is used to determine what action is taken when a control message
+is received.
+It is read by the
+.I parsecontrol
+script, which is called by all the control scripts.
+(For an explanation of how the control scripts are invoked, see
+.IR innd (8).)
+.PP
+The file consists of a series of lines; blank lines and lines beginning
+with a number sign (``#'') are ignored.
+All other lines consist of four fields separated by a colon:
+.RS
+message:from:newsgroups:action
+.RE
+.PP
+The first field is the name of the message for which this line is valid.
+It should be either the name of the control message, or the word ``all''
+to mean that it is valid for all messaages.
+.PP
+The second field is a shell-style pattern that matches the email address
+of the person posting the message.
+(The poster's address is first converted to lowercase.)
+The matching is done using the shell's
+.I case
+statement; see
+.I sh (1)
+for details.
+.PP
+If the control message is ``newgroup'' or ``rmgroup'' then the third
+field specifies the shell-style pattern that must match the group
+being created or removed.
+If the control message is of a different type, then this field is
+ignored.
+.PP
+The fourth field specifies what action to take if this line is selected
+for the message.
+The following actions are understood:
+.TP
+.B doit
+The action requested by the control message should be performed.
+In most cases the control script will also send mail to
+.\" =()<@<NEWSMASTER>@.>()=
+usenet.
+.TP
+.B doifarg
+If the control message has an argument, this is treated as a ``doit'' action.
+If no argument was given, it is treated as a ``mail'' entry.
+This is used in ``sendsys'' entries
+script so that a site can request its own
+.IR newsfeeds (5)
+entry by posting a ``sendsys mysite'' article.
+On the other hand, ``sendsys bombs'' ask that the
+.I newsfeeds
+file be sent; by using ``doifarg'' such messages will not be processed
+automatically.
+.TP
+.BI doit= file
+The action is performed, but a log entry is written to the specified
+log file,
+.IR file .
+If
+.I file
+is the word ``mail'' then the record is mailed.
+A null string is equivalent to /dev/null.
+A pathname that starts with a slash is taken as the absolute filename to
+use as the log.
+All other pathnames are written to
+.\" =()<.IR @<_PATH_MOST_LOGS>@/ file .log .>()=
+.IR /var/spool/news/data/ file .log .
+The log is written by
+.I writelog
+(see
+.IR newslog (8)).
+.TP
+.B drop
+No action is taken; the message is ignored.
+.TP
+.B log
+A one-line log notice is sent to standard error.
+.I Innd
+normally directs this to the file
+.\" =()<.IR @<_PATH_ERRLOG>@ .>()=
+.IR /var/spool/news/data/errlog .
+.TP
+.BI log =file
+A log entry is written to the specified log file,
+.IR file ,
+which is interpreted as described above.
+.TP
+.B mail
+A mail message is sent to the news administrator.
+.PP
+Lines are matched in order; the last match found in the file is the one
+that is used.
+For example, with the following three lines:
+.RS
+.nf
+newgroup:*:*:drop
+newgroup:tale@*.uu.net:comp.*|misc.*|news.*|rec.*|sci.*|soc.*|talk.*:doit
+newgroup:kre@munnari.oz.au:aus.*:mail
+.fi
+.RE
+A newgroup coming from ``tale'' at a UUNET machine will be honored if
+it is in one the mainstream Usenet hieararchy.
+If ``kre'' posts a newgroup message creating ``aus.foo'', then mail will
+be sent.
+All other newgroup messages are ignored.
+.SH HISTORY
+Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: control.ctl.5,v 1.4 1993/01/29 16:42:34 rsalz Exp $
+.SH "SEE ALSO"
+innd(8),
+newsfeeds(5),
+scanlogs(8).
diff --git a/usr/src/contrib/news/inn/doc/ctlinnd.8 b/usr/src/contrib/news/inn/doc/ctlinnd.8
new file mode 100644 (file)
index 0000000..542a357
--- /dev/null
@@ -0,0 +1,453 @@
+.\" $Revision: 1.30 $
+.TH CTLINND 8
+.SH NAME
+ctlinnd \- control the InterNetNews daemon
+.SH SYNOPSIS
+.B ctlinnd
+[
+.B \-h
+]
+[
+.B \-s
+]
+[
+.BI \-t " timeout"
+]
+.I command
+[
+.I argument...
+]
+.SH DESCRIPTION
+.I Ctlinnd
+sends a message to the control channel of
+.IR innd (8),
+the InterNetNews server.
+.PP
+In the normal mode of behavior, the message is sent to the server, which
+then performs the requested action and sends back a reply with a text
+message and the exit code for
+.IR ctlinnd .
+If the server successfully performed the command,
+.I ctlinnd
+will exit with a status of zero and print the reply on standard output.
+If the server could not perform the command (for example, it was told to
+remove a newsgroup that does not exist), it will direct
+.I ctlinnd
+to exit with a status of one.
+The ``shutdown,'' ``xabort,'' and ``xexec'' commands do not generate a reply;
+.I ctlinnd
+will always exit silently with a status of zero.
+If the ``\-s'' flag is
+used, then no message will be printed if the command was successful.
+.PP
+The ``\-t'' flag can be used to specify how long to wait for the reply
+from the server.
+The timeout value specifies the number of seconds to wait.
+A value of zero waits forever, and a value less
+than zero indicates that no reply is needed.
+When waiting for a reply,
+.I ctlinnd
+will try every two minutes to see if the server is still running, so it
+is unlikely that ``\-t0'' will hang.
+.\" =()<The default is ``\-t@<CTLINND_TIMEOUT>@.''>()=
+The default is ``\-t0.''
+.PP
+To see a command summary, use the ``\-h'' flag.
+If a command is included when
+.I ctlinnd
+is invoked with the ``\-h'' flag, then only the usage for that command
+will be given.
+.PP
+If a large number of groups are going to be created or deleted at once,
+it may be more efficient to ``pause'' or ``throttle'' the server
+and edit the
+.I active
+file directly.
+.PP
+The complete list of commands follows.
+Note that all commands have a fixed number of arguments.
+If a parameter can be an empty string, then it is necessary to
+specify it as two adjacent quotes, like "".
+.TP
+.BI addhist " <Message-ID> arr exp post paths"
+Add an entry to the history database.
+This directs the server to create a history line for
+.IR Message-ID .
+The angle brackets are optional.
+.IR Arr ,
+.IR exp ,
+and
+.I post
+specify when the article arrived, what its expiration date is, and
+when it was posted.
+All three values are a number indicating the number of seconds since the
+epoch.
+If the article does not have an Expires header, then
+.I exp
+should be zero.
+.I Paths
+is the pathname within the news spool directory where the article is filed.
+If the article is cross-posted, then the names should be separated by
+whitespace and the
+.I paths
+argument should be inside double quotes.
+If the server is paused or throttled, this command causes it to briefly
+open the history database.
+.TP
+.BI allow " reason"
+Remote connections are allowed.
+The
+.I reason
+must be the same text given with an earlier ``reject'' command, or an
+empty string.
+.TP
+.BI begin " site"
+Begin feeding
+.IR site .
+This will cause the server to rescan the
+.IR newsfeeds (5)
+file to find the specified site and set up a newsfeed for it.
+If the site already exists, a ``drop'' is done first.
+This command is forwarded; see below.
+.TP
+.BI cancel " <Message-ID>"
+Remove the article with the specified Message-ID from the local system.
+This does
+.I not
+generate a cancel message.
+The angle brackets are optional.
+If the server is paused or throttled, this command causes it to briefly
+open the history database.
+.TP
+.BI changegroup " group rest"
+The newsgroup
+.I group
+is changed so that its fourth field in the
+.I active
+file becomes the value specified by the
+.I rest
+parameter.
+This may be used to make an existing group moderated or unmoderated,
+for example.
+.TP
+.B checkfile
+Check the syntax of the
+.I newsfeeds
+file, and display a message if any errors are found.
+The details of the errors are reported to
+.IR syslog (3).
+.TP
+.BI drop " site"
+Flush and drop
+.I site
+from the server's list of active feeds.
+This command is forwarded; see below.
+.TP
+.BI flush " site"
+Flush the buffer for the specified site.
+The actions taken depend on the type of feed the site receives; see
+.IR newsfeeds (5).
+This is useful when the site is fed by a file and batching is going to start.
+If
+.I site
+is an empty string, then all sites are flushed and the
+.I active
+file and history databases are also written out.
+This command is forwarded; see below.
+.TP
+.B flushlogs
+Close the log and error log files and rename them to have a
+.I \&.old
+extension.
+The history database and
+.I active
+file are also written out.
+.TP
+.BI go " reason"
+Re-open the history database and start accepting articles after a ``pause''
+or ``throttle'' command.
+The
+.I reason
+must either be an empty string or match the text that was given
+in the earlier ``pause'' or ``throttle'' command.
+If a ``reject'' command was done, this will also do an ``allow'' command
+if the
+.I reason
+matches the text that was given in the ``reject.''
+If a ``reserve'' command was done, this will also clear the reservation if
+the
+.I reason
+matches the text that was given in the ``reserve.''
+Note that if only the history database has changed while the server is
+paused or throttled, it is not necessary to send it a ``reload'' command
+before sending it a ``go'' command.
+If the server throttled itself because it accumulated too many I/O
+errors, this command will reset the error count.
+If the server was not started with the ``\-ny'' flag, then this command also
+does a ``readers'' command with ``yes'' as the flag and
+.I reason
+as the text.
+.TP
+.BI hangup " channel"
+Close the socket on the specified incoming channel.
+This is useful when an incoming connection appears to be hung.
+.TP
+.BI help " [command]"
+Print a command summary for all commands, or just
+.I command
+if specified.
+.TP
+.BI mode
+Print the server's operating mode as a multi-line summary of the parameters
+and operating state.
+.TP
+.BI name " nnn"
+Print the name of channel number
+.I nnn
+or of all channels if it is an empty string.
+.TP
+.BI newgroup " group rest creator"
+Create the specified newsgroup.
+The
+.I rest
+parameter should be the fourth field as described in
+.IR active (5);
+if it is not an equal sign, only the first letter is used.
+The
+.I creator
+should be the name of the person creating the group.
+If the newsgroup already exists, this is equivalent to the ``changegroup''
+command.
+This is the only command that has defaults.
+The
+.I creator
+can be omitted and will default to the empty string, and the
+.I rest
+parameter can be omitted and will default to ``y''.
+This command can be done while the server is paused or throttled; it will
+update its internal state when a ``go'' command is sent.
+This command updates the
+.I active.times
+(see
+.IR active (5))
+file.
+.TP
+.BI param " letter value"
+Change the command-line parameters of the server.
+The combination of defaults make it possible to use the text of the Control
+header directly.
+.I Letter
+is the
+.I innd
+command-line option to set, and
+.I value
+is the new value.
+For example, ``i 5'' directs the server to allow only five incoming
+connections.
+To enable or disable the action of the ``\-n'' flag, use the letter ``y''
+or ``n'', respectively, for the
+.IR value.
+.TP
+.BI pause " reason"
+Pause the server so that no incoming articles are accepted.
+No existing connections are closed, but the history database is closed.
+This command should be used for short-term locks, such as when replacing
+the history files.
+If the server was not started with the ``\-ny'' flag, then this command also
+does a ``readers'' command with ``no'' as the flag and
+.I reason
+as the text.
+.TP
+.BI readers " flag text"
+Allow or disallow newsreaders.
+If
+.I flag
+starts with the letter ``n'' then newsreading is disallowed, by
+causing the server to pass the
+.I text
+as the value of the
+.IR nnrpd (8)
+\&``\-r'' flag.
+If
+.I flag
+starts with the letter ``y'' and
+.I text
+is either an empty string, or the same string that was used when newsreading
+was disallowed, then newsreading will be allowed.
+.\".TP
+.\".BI refile " path group"
+.\"The article specified by
+.\".I path
+.\"is refiled as if it were posted to the newsgroup
+.\".IR group .
+.TP
+.BI reject " reason"
+Remote connections (those that would not be handed off to
+.IR nnrpd )
+are rejected, with
+.I reason
+given as the explanation.
+.TP
+.BI reload " what reason"
+The server updates its in-memory copies of various configuration files.
+.I What
+identifies what should be reloaded.
+If it is an empty string or the word ``all'' then everything is reloaded;
+if it is the word ``history'' then the history database is closed and opened,
+if it is the word ``hosts.nntp'' then the
+.IR hosts.nntp (5)
+file is reloaded; if it is the word ``active'' or ``newsfeeds'' then both
+the
+.I active
+and
+.I newsfeeds
+files are reloaded; if it is the word ``overview.fmt'' then the
+.IR overview.fmt (5)
+file is reloaded.
+The
+.I reason
+is reported to
+.IR syslog .
+There is no way to reload the data
+.IR inn.conf (5)
+file; the server currently only uses the ``pathhost'' parameter, so this
+restriction should not be a problem.
+.TP
+.BI renumber " group"
+Scan the spool directory for the specified newsgroup and update the
+low-water mark in the
+.I active
+file.
+If
+.I group
+is an empty string then all newsgroups are scanned.
+.TP
+.BI reserve " reason"
+The next ``pause'' or ``throttle'' command must use
+.I reason
+as its text.
+This ``reservation'' is cleared by giving an empty string for the
+.IR reason .
+This command is used by programs like
+.IR expire (8)
+that want to avoid running into other instances of each other.
+.TP
+.BI rmgroup " group"
+Remove the specified newsgroup.
+This is done by editing the
+.I active
+file.
+The spool directory is not touched, and any articles in the group will
+be expired using the default expiration parameters.
+Unlike the ``newgroup'' command, this command does not update the
+.I active.times
+file.
+.TP
+.BI send " feed text..."
+The specified
+.I text
+is sent as a control line to the exploder
+.IR feed .
+.TP
+.BI shutdown " reason"
+The server is shut down, with the specified reason recorded in the log
+and sent to all open connections.
+It is a good idea to send a ``throttle'' command first.
+.TP
+.BI signal " sig site"
+Signal
+.I sig
+is sent to the specified
+.IR site ,
+which must be a channel or exploder feed.
+.I Sig
+can be a numeric signal number or the word ``hup,'' ``int,'' or ``term'';
+case is not significant.
+.TP
+.BI throttle " reason"
+Input is throttled so that all existing connections are closed and new
+connections are rejected.
+The history database is closed.
+This should be used for long-term locks, such as when
+.I expire
+is being run.
+If the server was not started with the ``\-ny'' flag, then this command also
+does a ``readers'' command with ``no'' as the flag and
+.I reason
+as the text.
+.TP
+.BI trace " item flag"
+Tracing is turned on or off for the specified
+.IR item .
+.I Flag
+should start with the letter ``y'' or ``n'' to turn tracing on or off.
+If
+.I item
+starts is a number, then tracing is set for the specified
+.I innd
+channel, which must be for an incoming NNTP feed.
+If it starts with the letter ``i'' then general
+.I innd
+tracing is turned on or off.
+If it starts with the letter ``n'' then future
+.IR nnrpd 's
+will or will not have the ``\-t'' flag enabled, as appropriate.
+.TP
+.BI xabort " reason"
+The server logs the specified
+.I reason
+and then invokes the
+.IR abort (3)
+routine.
+.TP
+.BI xexec " path"
+The server gets ready to shut itself down, but instead of exiting it
+execs the specified
+.I path
+with all of its original arguments.
+If
+.I path
+is ``innd'' then
+.\" =()<.I @<_PATH_INND>@>()=
+.I /usr/contrib/news/innd
+is invoked; if it is ``inndstart'' then
+.\" =()<.I @<_PATH_INNDSTART>@>()=
+.I /usr/contrib/news/inndstart
+is invoked; if it is an empty string, it will invoke the appropriate program
+depending on whether or not it was started with the ``\-p'' flag;
+any other value is an error.
+.PP
+In addition to being acted upon within the server, certain commands can
+be forwarded to the appropriate child process.
+If the site receiving the command is an exploder (such as
+.IR buffchan (8))
+or it is a funnel that feeds into an exploder, then the
+command can be forwarded.
+In this case, the server will send a command line to the exploder that
+consists of the
+.I ctlinnd
+command name.
+If the site funnels into an exploder that has an asterisk (``*'') in its ``W''
+flag (see
+.IR newsfweed (5)),
+then the site name will be appended to the command; otherwise no argument
+is appended.
+.SH BUGS
+.I Ctlinnd
+uses the
+.IR inndcomm (3)
+library, and is therefore limited to server replies no larger than 4k.
+.SH HISTORY
+Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: ctlinnd.8,v 1.30 1993/03/18 21:03:34 rsalz Exp $
+.SH "SEE ALSO"
+active(5),
+expire(8),
+innd(8),
+inndcomm(3),
+inn.conf(5),
+newsfeeds(5),
+overview.fmt(5).
diff --git a/usr/src/contrib/news/inn/doc/cvtbatch.8 b/usr/src/contrib/news/inn/doc/cvtbatch.8
new file mode 100644 (file)
index 0000000..8188305
--- /dev/null
@@ -0,0 +1,52 @@
+.\" $Revision: 1.2 $
+.TH CVTBATCH 8
+.SH NAME
+cvtbatch \- convert Usenet batch file to INN format
+.SH SYNOPSIS
+.I cvtbatch
+[
+.BI \-w " items"
+]
+.SH DESCRIPTION
+.I Cvtbatch
+reads standard input as a series of lines, converts each line, and
+writes it to standard output.
+It is used to convert simple batchfiles that contain just the article
+name to INN batchfiles that contain additional information about each
+article.
+.PP
+Each line is taken as the pathname to a Usenet article.
+If it is not an absolute pathname, it is taken relative to the spool
+directory,
+.\" =()<.IR @<_PATH_SPOOL>@ .>()=
+.IR /var/spool/news/spool .
+(Only the first word of each line is parsed; anything following
+whitespace is ignored.)
+.PP
+The ``\-w'' flag specifies how each output line should be written.
+The items for this flag should be chosen from the ``W'' flag items as
+specified in
+.IR newsfeeds (5).
+They may be chosen from the following set:
+.RS
+.nf
+       b       Size of article in bytes
+       f       full pathname of article
+       m       article message-id
+       n       relative pathname of article
+.fi
+.RE
+.PP
+If the input file consists of a series of Message-ID's, then use
+.IR grephistory (1)
+with the ``\-s'' flag piped into
+.IR cvtbatch .
+.SH HISTORY
+Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: cvtbatch.8,v 1.2 1992/09/14 19:21:03 rsalz Exp $
+.SH "SEE ALSO"
+grephistory(1)
+newsfeeds(5).
diff --git a/usr/src/contrib/news/inn/doc/distrib.pats.5 b/usr/src/contrib/news/inn/doc/distrib.pats.5
new file mode 100644 (file)
index 0000000..f8db485
--- /dev/null
@@ -0,0 +1,51 @@
+.\" $Revision: 1.5 $
+.TH DISTRIB.PATS 5
+.SH NAME
+distrib.pats \- default values for Usenet Distribution header
+.SH DESCRIPTION
+The file
+.\" =()<.I @<_PATH_DISTPATS>@>()=
+.I /var/spool/news/data/distrib.pats
+is used to determine the default value of the Distribution header.
+It consists of a series of lines; blank lines and lines beginning
+with a number sign (``#'') are ignored.
+All other lines consist of three fields separated by a colon:
+.RS
+.nf
+weight:pattern:value
+.fi
+.RE
+.PP
+The first field is the weight to assign to this match.
+If a newsgroup matches multiple lines, the line with the heighest weight
+is used.
+This should be an arbitrary number greater than zero.
+Unlike other INN files, the order of lines in this file is not important.
+.PP
+The second field is the name of the newsgroup or a
+.IR wildmat (3)-style
+pattern to specify a set of newsgroups.
+Multiple patterns are not allowed.
+.PP
+The third field is the value that should be used if this line is picked
+as the best match.
+It can be an empty string.
+.PP
+Programs such as
+.IR inews (1)
+that process a user's posting should consult this file, typically by using
+the
+.I DDxxx
+routines, documented in
+.IR libinn (3).
+The intent is that all newsgroups to which an article is posted be
+used to index into this file, and the value with the highest weight should
+be used as the value of the Distribution header, if none was specified.
+.SH HISTORY
+Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: distrib.pats.5,v 1.5 1993/01/29 16:42:38 rsalz Exp $
+.SH "SEE ALSO"
+inews(1), libinn(3).
diff --git a/usr/src/contrib/news/inn/doc/expire.8 b/usr/src/contrib/news/inn/doc/expire.8
new file mode 100644 (file)
index 0000000..b6c969a
--- /dev/null
@@ -0,0 +1,204 @@
+.\" $Revision: 1.15 $
+.TH EXPIRE 8
+.SH NAME
+expire \- Usenet article and history expiration program
+.SH SYNOPSIS
+.B expire
+[
+.BI \-d " dir"
+]
+[
+.BI \-f " file"
+]
+[
+.BI \-g " file"
+]
+[
+.BI \-h " file"
+]
+[
+.B \-i
+]
+[
+.B \-l
+]
+[
+.B \-n
+]
+[
+.B \-p
+]
+[
+.B \-q
+]
+[
+.BI \-r " reason"
+]
+[
+.B \-s
+]
+[
+.B \-t
+]
+[
+.BI \-v " level"
+]
+[
+.BI \-w " number"
+]
+[
+.B \-x
+]
+[
+.BI \-z " file"
+]
+[
+.I expire.ctl
+]
+.SH DESCRIPTION
+.I Expire
+scans the
+.IR history (5)
+text file
+.\" =()<.I @<_PATH_HISTORY>@>()=
+.I /var/spool/news/data/history
+and uses the information recorded in it to purge old news articles.
+To specify an alternate history file, use the ``\-f'' flag.
+To specify an alternate input text history file, use the ``\-h'' flag.
+.I Expire
+uses the old
+.IR dbz (3z)
+database to determine the size of the new one.
+To ignore the old database, use the ``\-i'' flag.
+.PP
+.I Expire
+normally just unlinks each file if it should be expired.
+If the ``\-l'' flag is used, then all articles after the first one are
+treated as if they could be symbolic links to the first one.
+In this case, the first article will not be removed as long as any other
+cross-posts of the article remain.
+.PP
+.I Expire
+normally sends a ``pause'' command to the local
+.IR innd (8)
+daemon when it needs exclusive access to the history file, using
+the string ``Expiring'' as the reason.
+To give a different reason, use the ``\-r'' flag.
+The process ID will be appended to the reason.
+When
+.I expire
+is finished and the new history file is ready, it sends a ``go'' command.
+If
+.I innd
+is not running, use the ``\-n'' flag and
+.I expire
+will not send the ``pause'' or ``go'' commands.
+(For more details on the commands, see
+.IR ctlinnd (8)).
+Note that
+.I expire
+only needs exclusive access for a very short time \(em long enough to see
+if any new articles arrived since it first hit the end of the file, and to
+rename the new files to the working files.
+.PP
+If the ``\-s'' flag is used, then
+.I expire
+will print a summary when it exits showing the approximate number of
+kilobytes used by all deleted articles.
+.PP
+If the ``\-t'' flag is used, then
+.I expire
+will generate a list of the files that should be removed on its
+standard output, and the new history file will be left in
+.I history.n
+and
+.I history.n.dir
+and
+.IR history.n.pag .
+This flag be useful for debugging when used with the ``\-n'' and ``\-s'' flags.
+Note that if the ``\-f'' flag is used, then the name specified with that flag
+will be used instead of
+.IR history .
+.PP
+If the ``\-x'' flag is used, then
+.I expire
+will not create any new history files.
+This is most useful when combined with the ``\-n'', ``\-s'', and ``\-t'' flags
+to see how different expiration policies would change the amount of disk space
+used.
+.PP
+If the ``\-z'' flag is used, then articles are not removed, but their
+names are written to the specified
+.IR file .
+See the description of
+.I expirerm
+in
+.IR news.daily (8).
+.PP
+.I Expire
+makes its decisions on the time the article arrived, as found in the
+.I history
+file.
+This means articles are often kept a little longer than with other
+expiration programs that base their decisions on the article's posting
+date.
+To use the article's posting date, use the ``\-p'' flag.
+Use the ``\-w'' flag to ``warp'' time so that
+.I expire
+thinks it is running at some time other then the current time.
+The value should be a signed floating point number of the number of days
+to use as the offset.
+.PP
+If the ``\-d'' flag is used, then the new history file and database is
+created in the specified directory,
+.IR dir .
+This is useful when the filesystem does not have sufficient space to
+hold both the old and new history files.
+When this flag is used,
+.I expire
+leaves the server paused and creates a zero-length file named after the
+new history file, with an extension of ``.done'' to indicate that
+it has successfully completed the expiration.
+The calling script should install the new history file and un-pause the server.
+The ``\-r'' flag should be used with this flag.
+.PP
+If a filename is specified, it is taken as the control file and parsed
+according to the rules in
+.IR expire.ctl (5).
+A single dash (``\-'') may be used to read the file from standard input.
+If no file is specified, the file
+.\" =()<.IR @<_PATH_EXPIRECTL>@>()=
+.IR /var/spool/news/data/expire.ctl
+is read.
+.PP
+.I Expire
+normally complains about articles that are posted to newsgroups not
+mentioned in the active file.
+To suppress this action, use the ``\-q'' flag.
+.PP
+The ``\-v'' flag is used to increase the verbosity of the program,
+generating messages to standard output.
+The
+.I level
+should be a number, where higher numbers result in more output.
+Level one will print totals of the various actions done (not valid if a
+new history file is not written), level two will print report on each
+individual file, while level five results in more than one line of output
+for every line processed.
+If the ``\-g'' flag is given, then a one-line summary equivalent to the
+output of ``\-v1'' and preceeded by the current time, will be appended to
+the specified
+.IR file .
+.SH HISTORY
+Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: expire.8,v 1.15 1993/03/18 21:03:35 rsalz Exp $
+.SH "SEE ALSO"
+ctlinnd(8),
+dbz(3z),
+expire.ctl(5),
+history(5),
+innd(8),
+inndcomm(3).
diff --git a/usr/src/contrib/news/inn/doc/expire.ctl.5 b/usr/src/contrib/news/inn/doc/expire.ctl.5
new file mode 100644 (file)
index 0000000..958298e
--- /dev/null
@@ -0,0 +1,147 @@
+.\" $Revision: 1.11 $
+.TH EXPIRE.CTL 5
+.SH NAME
+expire.ctl \- control file for Usenet article expiration
+.SH DESCRIPTION
+The file
+.\" =()<.I @<_PATH_EXPIRECTL>@>()=
+.I /var/spool/news/data/expire.ctl
+is the default control file for the
+.IR expire (8)
+program, which reads it at start-up.
+Blank lines and lines beginning with a number sign (``#'') are ignored.
+All other lines should be in one of two formats.
+.PP
+The first format specifies how long to keep a record of fully-expired
+articles.
+This is useful when a newsfeed intermittently offers older news that
+is not kept around very long.
+(The case of very old news is handled by the ``\-c'' flag of
+.IR innd (8).)
+There should only be one line in this format, which looks like this:
+.RS
+/remember/:days
+.RE
+Where
+.I days
+is a floating-point number that specifies the upper limit to remember
+a Message-ID, even if the article has already expired.
+(It does not affect article expirations.)
+.PP
+Most of the lines in the file will consist of five colon-separated fields,
+as follows:
+.RS
+.nf
+pattern:modflag:keep:default:purge
+.fi
+.RE
+The
+.I pattern
+field is comma-separated set of single
+.IR wildmat (3)-style
+patterns that specify the newsgroups to which the rest of the line applies.
+Since the file is interpreted in order, the most general patterns
+should be specified first, and the most specific patterns should be
+specified last.
+.PP
+The
+.I modflag
+field can be used to further limit newsgroups to which the line applies,
+and should be chosen from the following set:
+.RS
+.nf
+M      Only moderated groups
+U      Only unmoderated groups
+A      All groups
+.fi
+.RE
+.PP
+The next three fields are used to determine how long an article
+should be kept.
+Each field should be either a number of days (fractions like ``8.5'' are
+allowed) or the word ``never.''
+The most common use is to specify the default value for how long an
+article should be kept.
+The first and third fields \(em
+.I keep
+and
+.I purge
+\(em specify the boundaries within which an Expires
+header will be honored.
+They are ignored if an article has no Expires header.
+The fields are specified in the file as ``lower-bound default upper-bound,''
+and they are explained in this order.
+Since most articles do not have explicit expiration dates, however,
+the second field tends to be the most important one.
+.PP
+The
+.I keep
+field specifies how many days an article should be kept before it will
+be removed.
+No article in the newsgroup will be removed if it has been filed
+for less then
+.I keep
+days, regardless of any expiration date.
+If this field is the word ``never'' then an article cannot have been kept
+for enough days so it will never be expired.
+.PP
+The
+.I default
+field specifies how long to keep an article if no Expires header
+is present.
+If this field is the word ``never'' then articles without explicit
+expiration dates will never be expired.
+.PP
+The
+.I purge
+field specifies the upper bound on how long an article can be kept.
+No article will be kept longer then the number of days specified by this
+field.
+All articles will be removed after then have been kept for
+.I purge
+days.
+If
+.I purge
+is the word ``never'' then the article will never be deleted.
+.PP
+It is often useful to honor the expiration headers in articles, especially
+those in moderated groups.
+To do this, set
+.I keep
+to zero,
+.I default
+to whatever value you wish, and
+.I purge
+to never.
+To ignore any Expires header, set all three fields to the same value.
+.PP
+There must be exactly one line with a
+.I pattern
+of ``*'' and a
+.I modflags
+of ``A'' \(em this matches all groups and is used to set the expiration
+default.
+It should be the first expiration line.
+.PP
+For example,
+.RS
+.nf
+##  How long to keep expired history
+/remember/:5
+##  Most things stay for two weeks
+*:A:14:14:14
+##  Believe expiration dates in moderated groups, up to six weeks
+*:M:1:30:42
+##  Keep local stuff for a long time
+foo.*:A:30:30:30
+.fi
+.RE
+.SH HISTORY
+Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: expire.ctl.5,v 1.11 1993/01/29 16:42:42 rsalz Exp $
+.SH "SEE ALSO"
+expire(8),
+wildmat(3).
diff --git a/usr/src/contrib/news/inn/doc/expireover.8 b/usr/src/contrib/news/inn/doc/expireover.8
new file mode 100644 (file)
index 0000000..583f4fc
--- /dev/null
@@ -0,0 +1,94 @@
+.\" $Revision: 1.3 $
+.TH EXPIREOVER 8
+.SH NAME
+expireover \- Expire entries from the news overview database
+.SH SYNOPSIS
+.B expireover
+[
+.B \-a
+]
+[
+.BI \-D " overviewdir"
+]
+[
+.BI \-f " file"
+]
+[
+.B \-n
+]
+[
+.BI \-O " overview.fmt"
+]
+[
+.B \-s
+]
+[
+.B \-v
+]
+[
+.B \-z
+]
+[
+.I file...
+]
+.SH DESCRIPTION
+.I Expireover
+expires entries from the news overview database.
+It reads a list of pathnames (relative to the spool directory,
+.\" =()<.IR @<_PATH_SPOOL>@ ),>()=
+.IR /var/spool/news/spool ),
+from the specified
+.I files
+or standard input if none are specified.
+(A file name of ``\-'' may be used to specify the standard input.)
+It then removes any mention of those articles from the appropriate overview
+database.
+If the ``\-z'' flag is used, then the input is assumed to be sorted such
+that all entries for a newsgroup appear together so that it can be purged
+at once.
+This flag can be useful when used with the sorted output of
+.IR expire (8)'s
+\&``\-z'' flag.
+.PP
+If the ``\-s'' flag is used, then
+.I expireover
+will read the spool directory for all groups mentioned in the
+.IR active (5)
+file, and remove the overview entries for any articles that do not appear.
+To specify an alternate file, use the ``\-f'' flag; a name of ``\-'' is
+taken to mean the standard input.
+.PP
+The ``\-a'' flag reads the spool directory and adds any missing
+overview entries.
+It will create files if necessary.
+This can be used to initialize a database, or to sync up a overview
+database that may be lacking articles due to a crash.
+.I Overchan
+should be running, to ensure that any incoming articles get included.
+Using this flag implies the ``\-s'' flag; the ``\-f'' flag may be used
+to add only a subset of the newsgroups.
+.PP
+To see a list of the entries that would be added or deleted, use the ``\-v''
+flag.
+To perform no real updates, use the ``\-n'' flag.
+.PP
+The ``\-D'' flag can be used to specify where the databases are stored.
+The default directory is
+.\" =()<.IR @<_PATH_OVERVIEWDIR>@ .>()=
+.IR /var/spool/news/spool .
+.PP
+The ``\-O'' flag may be used to specify an alternate location for the
+.IR overview.fmt (5)
+file; this is normally only useful for debugging.
+.SH HISTORY
+Written by Rob Robertson <rob@violet.berkeley.edu>
+and Rich $alz <rsalz@uunet.uu.net>
+(with help from Dave Laurence <tale@uunet.uu.net>)
+for InterNetNews.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: expireover.8,v 1.3 1993/03/18 21:03:36 rsalz Exp $
+.SH "SEE ALSO"
+expire(8),
+overview.fmt(5).
diff --git a/usr/src/contrib/news/inn/doc/filechan.8 b/usr/src/contrib/news/inn/doc/filechan.8
new file mode 100644 (file)
index 0000000..c0f1acc
--- /dev/null
@@ -0,0 +1,133 @@
+.\" $Revision: 1.14 $
+.TH FILECHAN 8
+.SH NAME
+filechan \- file-writing backend for InterNetNews
+.SH SYNOPSIS
+.B filechan
+[
+.BI \-d " directory"
+]
+[
+.BI \-f " fields"
+]
+[
+.BI \-m " mapfile"
+]
+[
+.BI \-p " pidfile"
+]
+.SH DESCRIPTION
+.I Filechan
+reads lines from standard input and copies certain fields in
+each line into files named by other fields within the line.
+.I Filechan
+is intended to be called by
+.IR innd (8)
+as a channel feed.
+(It is not a full exploder and does not accept commands; see
+.IR newsfeeds (5) for a description of the difference and
+.IR buffchan (8) for an exploder program.)
+.PP
+.I Filechan
+input is interpreted as a set of lines.
+Each line contains a fixed number of initial fields, followed by a
+variable number of filename fields.
+All fields in a line are separated by whitespace.
+The default number of initial fields is one; the ``\-f'' flag may be
+used to specify a different number of fields.
+.PP
+For each line of input,
+.I filechan
+writes the initial fields, separated by whitespace and followed by a
+newline, to each of the files named in the filename fields.
+When writing to a file,
+.I filechan
+opens it in append mode and tries to lock it and change the
+ownership to the user and group who owns the directory where the file is
+being written.
+.PP
+By default,
+.I filechan
+writes its arguments into the directory
+.\" =()<.IR @<_PATH_BATCHDIR>@ .>()=
+.IR /var/spool/news/out.going .
+The ``\-d'' flag may be used to specify a directory the program should
+change to before starting.
+.PP
+If the ``\-p'' flag is used, the program will write a line containing
+its process ID (in text) to the specified file.
+.PP
+If
+.I filechan
+is invoked with ``\-f 2'' and given the following input:
+.RS
+.nf
+news/software/b/132 <1643@munnari.oz.au> foo uunet
+news/software/b/133 <102060@litchi.foo.com> uunet munnari
+comp/sources/unix/2002 <999@news.foo.com> foo uunet munnari
+.fi
+.RE
+.PP
+Then the file
+.I foo
+will have these lines:
+.RS
+.nf
+news/software/b/132 <1643@munnari.oz.au>
+comp/sources/unix/2002 <999@news.foo.com>
+.fi
+.RE
+.sp
+the file
+.I munnari
+will have these lines:
+.RS
+.nf
+news/software/b/133 <102060@litchi.foo.com>
+comp/sources/unix/2002 <999@news.foo.com>
+.fi
+.RE
+.sp
+and the file
+.I uunet
+will have these lines:
+.RS
+.nf
+news/software/b/132 <1643@munnari.oz.au>
+news/software/b/133 <102060@litchi.foo.com>
+comp/sources/unix/2002 <999@news.foo.com>
+.fi
+.RE
+.PP
+Because the time window in which a file is open is very small, complicated
+flushing and locking protocols are not needed; a
+.IR mv (1)
+followed by a
+.IR sleep (1)
+for a couple of seconds is sufficient.
+.PP
+A map file may be specified by using the ``\-m'' flag.
+Blank lines and lines starting with a number sign (``#'') are ignored.
+All other lines should have two host names separated by a colon.
+The first field is the name that may appear in the input stream;
+the second field names the file to be used when the name in the first
+field appears.
+For example, the following map file may be used to map the short
+names above to the full domain names:
+.RS
+# This is a comment
+uunet:news.uu.net
+foo:foo.com
+munnari:munnari.oz.au
+.RE
+.SH HISTORY
+Written by Robert Elz <kre@munnari.oz.au>, flags added by Rich $alz
+<rsalz@uunet.uu.net>.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: filechan.8,v 1.14 1993/03/18 21:03:36 rsalz Exp $
+.SH "SEE ALSO"
+buffchan(8),
+innd(8),
+newsfeeds(5).
diff --git a/usr/src/contrib/news/inn/doc/getlist.1 b/usr/src/contrib/news/inn/doc/getlist.1
new file mode 100644 (file)
index 0000000..13c122c
--- /dev/null
@@ -0,0 +1,90 @@
+.\" $Revision: 1.3 $
+.TH GETLIST 1
+.SH NAME
+getlist \- get a list from an NNTP server
+.SH SYNOPSIS
+.I getlist
+[
+.BI \-h " host"
+]
+[
+.I list
+[
+.I pattern
+[
+.I types
+]
+]
+]
+.SH DESCRIPTION
+The
+.I getlist
+program obtains a list from an NNTP server and sends
+it to standard output.
+.PP
+The
+.B list
+may be one of
+.IR active ,
+.IR active.times ,
+.IR distributions ,
+or
+.IR newsgroups .
+These values request the
+.IR active (5),
+.IR active.times ,
+.\" =()<.IR @<_PATH_NEWSLIB>@/distributions ,>()=
+.IR /var/spool/news/data/distributions ,
+or
+.\" =()<.I @<_PATH_NEWSLIB>@/newsgroups>()=
+.I /var/spool/news/data/newsgroups
+files, respectively.
+.PP
+If the ``\-h'' flag is used, then the program connects to the server
+on the specified host.
+The default is to connect to the server specified in the
+.IR inn.conf (5)
+file.
+.PP
+If the
+.I list
+parameter is
+.IR active ,
+then the 
+.I pattern
+and
+.I types
+parameters may be used to limit the output.
+When
+.I pattern
+is used, only active lines with groups that match according to
+.IR wildmat (3)
+are printed.
+When
+.I types
+is also given, only active lines that have a fourth field starting
+with a character found in
+.I types
+are printed.
+.PP
+For example, the following command will obtain the one-line descriptions
+of all newsgroups found on UUNET:
+.RS
+getlist -h news.uu.net newsgroups
+.RE
+.PP
+The following line lists all groups where local postings are permitted,
+are moderated or aliased:
+.RS
+getlist active '*' ym=
+.RE
+.PP
+Note that the listing files other than the active file is a common
+extension to the NNTP protocol and may not be available on all servers.
+.SH HISTORY
+Written by Landon Curt Noll <chongo@toad.com> for InterNetNews.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.SH "SEE ALSO"
+active(5), nnrpd(8), wildmat(3).
diff --git a/usr/src/contrib/news/inn/doc/history.5 b/usr/src/contrib/news/inn/doc/history.5
new file mode 100644 (file)
index 0000000..0e559ed
--- /dev/null
@@ -0,0 +1,90 @@
+.\" $Revision: 1.9 $
+.TH HISTORY 5
+.SH NAME
+history \- record of current and recently expired Usenet articles
+.SH DESCRIPTION
+The file
+.\" =()<.I @<_PATH_HISTORY>@>()=
+.I /var/spool/news/data/history
+keeps a record of all articles currently stored in the news system,
+as well as those that have been received but since expired.
+.PP
+The file consists of text lines.
+Each line corresponds to one article.
+The file is normally kept sorted in the order in which articles are
+received, although this is not a requirement.
+.IR Innd (8)
+appends a new line each time it files an article, and
+.IR expire (8)
+builds a new version of the file by removing old articles and purging
+old entries.
+.PP
+Each line consists of two or three fields separated by a tab, shown below
+as
+.IR \et :
+.RS
+.nf
+<Message\-ID>   \et   date
+<Message\-ID>   \et   date   \et   files
+.fi
+.RE
+.PP
+The
+.I Message\-ID
+field is the value of the article's Message-ID header, including the
+angle brackets.
+.PP
+The
+.I date
+field consists of three sub-fields separated by a tilde.
+All sub-fields are the text representation of the number of seconds since
+the epoch \(em
+.IR i.e. ,
+a
+.IR time_t ;
+see
+.IR gettimeofday (2).
+The first sub-field is the article's arrival date.
+If copies of the article are still present then the second sub-field is
+either the value of the article's Expires header, or a hyphen if no
+expiration date was specified.
+If an article has been expired then the second sub-field will be a hyphen.
+The third sub-field is the value of the article's Date header, recording
+when the article was posted.
+.PP
+The
+.I files
+field is a set of entries separated by one or more spaces.
+Each entry consists of the name of the newsgroup, a slash, and the article
+number.
+This field is empty if the article has been expired.
+.PP
+For example, an article cross-posted to comp.sources.unix and
+comp.sources.d that was posted on February 10, 1991 (and received three
+minutes later), with an expiration date of May 5, 1991, could have a
+history line (broken into two lines for display) like the
+following:
+.RS
+.nf
+<312@litchi.foo.com>  \et  666162000~673329600~666162180  \et
+    comp.sources.unix/1104 comp.sources.d/7056
+.fi
+.RE
+.PP
+In addition to the text file, there is a
+.IR dbz (3z)
+database associated with the file that uses the Message-ID field as a key
+to determine the offset in the text file where the associated line begins.
+For historical reasons, the key includes the trailing \e0 byte
+(which is not stored in the text file).
+.SH HISTORY
+Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: history.5,v 1.9 1993/01/29 16:42:49 rsalz Exp $
+.SH "SEE ALSO"
+dbz(3z),
+expire(8),
+innd(8),
+news-recovery(8).
diff --git a/usr/src/contrib/news/inn/doc/hosts.nntp.5 b/usr/src/contrib/news/inn/doc/hosts.nntp.5
new file mode 100644 (file)
index 0000000..99fd609
--- /dev/null
@@ -0,0 +1,86 @@
+.\" $Revision: 1.17 $
+.TH HOSTS.NNTP 5
+.SH NAME
+hosts.nntp, hosts.nntp.nolimit \- list of hosts that feed NNTP news
+.SH DESCRIPTION
+The file
+.\" =()<.I @<_PATH_INNDHOSTS>@>()=
+.I /var/spool/news/data/hosts.nntp
+is read by
+.IR innd (8)
+to get the list of hosts that feed the local site Usenet news
+using the NNTP protocol.
+The server reads this file at start-up or when directed to by
+.IR ctlinnd (8).
+When a hosts connects to the NNTP port of the system on which
+.I innd
+is running, the server will do a check to see if their Internet address
+is the same as one of the hosts named in this file.
+If the host is not mentioned, then
+.I innd
+will spawn an
+.IR nnrpd (8)
+to process the connection, with the accepted connection on standard input
+and standard output.
+.PP
+Comments begin with a number sign (``#'') and continue through the end of
+the line.
+Blank lines and comments also ignored.
+All other lines should consist of two or three fields separated by a colon.
+.PP
+The first field should be either an Internet address in dotted-quad
+format or an address that can be parsed by
+.IR gethostbyname (3).
+If a host's entry has multiple addresses, all of them will be added to
+the access list.
+The second field, which may be blank, is the password the foreign host is
+required to use when first connecting.
+The third field, which may be omitted, is a list of newsgroups to which
+the host may post articles.
+This list is parsed as a
+.IR newsfeeds (5)
+subscription list; groups not in the list are ignored.
+.PP
+Since
+.I innd
+is usually started at system boot time, the local nameserver may not be
+fully operational when
+.I innd
+parses this file.
+As a work-around, a
+.I ctlinnd
+``reload'' command can be performed after a delay of an hour or so.
+It is also possible to provide both a host's name and its dotted-quad
+address in the file.
+.PP
+For example:
+.RS
+.nf
+##  FOO has a password, UUNET doesn't.
+##  UUNET cannot post to local group.s
+##  These are comment lines.
+news.foo.com:magic
+uunet.uu.net::!foo.*
+.fi
+.RE
+.PP
+If the file contains passwords, it should not be world-readable.
+The file
+.\" =()<.IR @<_PATH_INNDHOSTS>@.nolimit ,>()=
+.IR /var/spool/news/data/hosts.nntp.nolimit ,
+if it exists is read whenever the ``hosts.nntp'' file is read.
+It has the same format, although only the first field is used.
+Any host mentioned in this file is not subject to the incoming connections
+limit specified by
+.IR innd 's
+\&``\-c'' flag.
+This can be used to allow local hosts or time-sensitive peers, to connect
+regardless of the local conditions.
+.SH HISTORY
+Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: hosts.nntp.5,v 1.17 1993/03/18 21:03:37 rsalz Exp $
+.SH "SEE ALSO"
+ctlinnd(8), innd(8), nnrpd(8).
diff --git a/usr/src/contrib/news/inn/doc/inews.1 b/usr/src/contrib/news/inn/doc/inews.1
new file mode 100644 (file)
index 0000000..15f3b6c
--- /dev/null
@@ -0,0 +1,158 @@
+.\" $Revision: 1.25 $
+.TH INEWS 1
+.SH NAME
+inews \- send a Usenet article to the local news server for distribution
+.SH SYNOPSIS
+.B inews
+[
+.B \-h
+]
+[
+.B \-D
+]
+[
+.B \-O
+]
+[
+.B \-R
+]
+[
+.B \-S
+]
+[
+.I "header_flags"
+]
+[
+.I input
+]
+.SH DESCRIPTION
+.I Inews
+reads a Usenet news article (perhaps with headers) from
+the named file or standard input if no file is given.
+It adds some headers and performs some consistency checks.
+If the article does not meet these checks (for example, too much
+quoting of old articles, or posting to non-existent newsgroups) then
+the article is rejected.
+If it passes the checks,
+.I inews
+sends the article to the local news
+server as specified in the
+.IR inn.conf (5)
+file for distribution.
+.PP
+In the standard mode of operation, the input consists of the article
+headers, a blank line, and the message body.
+For compatibility with older software, the ``\-h'' flag must be used.
+If there are no headers in the message, then this flag may be omitted.
+.PP
+Several headers may be specified on the command line, shown in the
+synopsis above as
+.IR "header_flags" .
+Each of these flags takes a single parameter; if the value is more than
+one word (for example, almost all Subject lines) then quotes must be used
+to prevent the shell from splitting it into multiple words.
+The options, and their equivalent header, are as follows:
+.RS
+.nf
+a      Approved
+c      Control
+d      Distribution
+e      Expires
+f      From
+w      Followup-To
+n      Newsgroups
+r      Reply-To
+t      Subject
+F      References
+o      Organization
+x      Path prefix
+.fi
+.RE
+.PP
+.\" =()<.if '@<INEWS_PATH>@'DO' \{\>()=
+.if 'DO'DO' \{\
+The Path header is built according to the following rules.\}
+If the ``\-x'' flag is used, then its value will be the start of the header.
+Any other host will see the site in the header, and therefore not
+offer the article to that site.
+.\" =()<.if '@<INEWS_PATH>@'DO' \{\>()=
+.if 'DO'DO' \{\
+If the ``pathhost'' configuration parameter is specified in the
+.IR inn.conf (5)
+file, then it will be added to the Path.
+Otherwise, if the ``server'' configuration parameter is specified,
+then the full domain name of the local host will be added to the Path.\}
+The Path will always end
+.\" =()<.IR @<PATHMASTER>@ .>()=
+.IR not-for-mail .
+.PP
+The default Organization header will be provided if none is present
+in the article or if the ``\-o'' flag is not used.
+To prevent adding the default, use the ``\-O'' flag.
+.PP
+As a debugging aide, if the ``\-D'' flag is used, the consistency checks
+will be performed, and the article will be sent to the standard output,
+rather then sent to the server.
+.PP
+For compatibility with C News,
+.I inews
+accepts, but ignores, the ``\-A'', ``\-V'' and ``\-W'' flags.
+The C News ``\-N'' flag is treated as the ``\-D'' flag.
+.PP
+If a file named
+.I .signature
+exists in the user's home directory,
+.I inews
+will try to append it to the end of the article.
+If the file cannot be read, or if it is too long (for example, more than
+four lines or one standard I/O buffer), or if some other problem occurs,
+then the article will not be posted.
+To suppress this action use the ``\-S'' flag.
+.PP
+If the ``\-R'' flag is used then
+.I inews
+will reject any attempts to post control messages.
+.PP
+If an unapproved posting is made to a moderated newsgroup,
+.I inews
+will try to mail the article to the moderator for posting.
+It uses the
+.IR moderators (5)
+file to determine the mailing address.
+If no address is found, it will use the
+.IR inn.conf
+file to determine a ``last-chance'' host to try.
+.PP
+If the NNTP server needs to authenticate the client,
+.I inews
+will use the
+.IR NNTPsendpassword (3)
+routine to authenticate itself.
+In order to do this, the program will need read access to the
+.IR passwd.nntp (5)
+file.
+This is typically done by having the file group-readable and making
+.I inews
+run setgid to that group.
+.PP
+.I Inews
+exits with a zero status if the article was succesfully posted or mailed,
+or with a non-zero status if the article could not be delivered.
+.PP
+Since
+.I inews
+will spool its input if the server is unavailable, it is usually necessary
+to run
+.IR rnews (1)
+with the ``\-U'' flag on a regular basis, usually out of
+.IR cron (8).
+.SH HISTORY
+Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: inews.1,v 1.25 1993/03/18 21:03:38 rsalz Exp $
+.SH "SEE ALSO"
+moderators(5),
+inn.conf(5).
+rnews(1).
diff --git a/usr/src/contrib/news/inn/doc/inn.conf.5 b/usr/src/contrib/news/inn/doc/inn.conf.5
new file mode 100644 (file)
index 0000000..3ba2681
--- /dev/null
@@ -0,0 +1,121 @@
+.\" $Revision: 1.14 $
+.TH INN.CONF 5
+.SH NAME
+inn.conf \- configuration data for InterNetNews programs
+.SH DESCRIPTION
+The file
+.\" =()<.I @<_PATH_CONFIG>@>()=
+.I /var/spool/news/data/inn.conf
+is used to determine various parameters.
+Blank lines and lines starting with a number sign (``#'') are ignored.
+All other lines specify parameters that may be read, and should be of
+the following form:
+.RS
+.nf
+name : [optional whitespace] value
+.fi
+.RE
+Everything after the whitespace and up to the end of the line is taken as
+the value; multi-word values should not be put in quotes.
+The case of names is significant \(em
+.I server
+is not the same as
+.I Server
+or
+.IR SERVER .
+.PP
+Some parameters specified in the file may be overridden by environment
+variables, and some file parameters may be used to mask real data, such
+as when hiding a cluster of hosts behind a single electronic mail hostname.
+The current set of parameters is as follows:
+.TP
+.I fromhost
+This is the name of the host to use when building the From header line.
+The default is the fully-qualified domain name of the local host.
+The value of the FROMHOST environment variable, if it exists,
+overrides this.
+.TP
+.I moderatormailer
+This names the default machine that contains forwarding aliases for all
+moderated groups.
+It is only used if the
+.IR moderators (5)
+file doesn't exist, or if the group is not matched by that file.
+The value is interpreted as a pattern match; see
+.IR moderators (5).
+.TP
+.I organization
+This specifies what to put in the Organization header if it is blank.
+The value of the ORGANIZATION environment variable, if it exists,
+overrides this.
+.TP
+.I pathhost
+This specifies how to name the local site when building the Path header line.
+The default is the fully-qualified domain name of the local host.
+.TP
+.I server
+This specifies the name of the NNTP server to which an article should be
+posted.
+The value of the NNTPSERVER environment variable, if it exists,
+overrides this.
+.TP
+.I domain
+This should be the domain name of the local host.
+It should not have a leading period, and it should not be a full host address.
+It is used only if the
+.I GetFQDN
+routine in
+.IR libinn (3)
+cannot get the fully-qualified domain name by using either the
+.IR gethostname (2)
+or
+.IR gethostbyname (3)
+calls.
+The check is very simple; if either routine returns a name with a period
+in it, then it is assumed to have the full domain name.
+.PP
+Three parameters are used only by
+.I nnrpd
+when accepting postings from clients:
+.TP
+.I mime-version
+If this parameter is present, then
+.I nnrpd
+will add the necessary MIME (Multipurpose Internet Mail Extensions)
+headers to all any articles that do not have a Mime-Version header.
+This parameter specifies the MIME version, and should normally be ``1.0''.
+.TP
+.I mime-contenttype
+If MIME headers are being added, this parameter specifies the value
+of the Content-Type header.
+The default value is ``text/plain; charset=US-ASCII.''
+.TP
+.I mime-encoding
+If MIME headers are being added, this parameter specifies the value of
+the Content-Transfer-Encoding header.
+The default value is ``7bit.''
+.PP
+Note that this file can be identical on all machines in an organization.
+.SH EXAMPLE
+.RS
+.nf
+.ta \w'moderatormailer:    'u
+fromhost:      foo.com
+moderatormailer:       %s@uunet.uu.net
+organization:  Foo, Incorporated
+#pathhost -- use FQDN.
+server:        news.foo.com
+domain: foo.com
+.fi
+.RE
+.PP
+This file is intended to be fairly static; any changes made to it are
+typically not reflected until a program restarts.
+.SH HISTORY
+Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: inn.conf.5,v 1.14 1993/01/29 16:42:52 rsalz Exp $
+.SH "SEE ALSO"
+libinn(3), moderators(5).
diff --git a/usr/src/contrib/news/inn/doc/innwatch.ctl.5 b/usr/src/contrib/news/inn/doc/innwatch.ctl.5
new file mode 100644 (file)
index 0000000..3e71d07
--- /dev/null
@@ -0,0 +1,215 @@
+.\" $Revision: 1.3 $
+.TH INNWATCH.CTL 5
+.SH NAME
+innwatch.ctl \- control Usenet supervision by innwatch
+.SH DESCRIPTION
+The file
+.\" =()<.I @<_PATH_CTLWATCH>@>()=
+.I /var/spool/news/data/innwatch.ctl
+is used to determine what actions are taken during the periodic
+supervisions by
+.IR innwatch .
+.PP
+The file consists of a series of lines; blank lines and lines beginning
+with a number sign (``#'') are ignored.
+All other lines consist of seven fields, each preceded by a delimiting
+character:
+.RS
+:label:state:condition:test:limit:command:reason
+.RE
+.PP
+The delimiter can be any one of several non-alphanumeric characters that does
+not appear elsewhere in the line; there is no way to quote it to
+include it in any of the fields.
+Any of ``!'', ``,'', ``:'', ``@'', ``;'', or ``?'' is a good choice.
+Each line can have a different delimiter; the first character on each line
+is the delimiter for that line.
+White space surrounding delimiters, except before the first, is ignored,
+and does not form part of the fields, white space within fields is
+permitted.
+All delimiters must be present.
+.PP
+The first field is a label for the control line.
+It is used as an internal state indicator and in
+.I ctlinnd
+messages to control the server.
+If omitted, the line number is used.
+.PP
+The second field specifies when this control line should be used.
+It consists of a list of labels,
+and special indicators,
+separated by whitespace.
+If the current state matches against any of the labels in this field,
+this line will be used as described below.
+The values that may be used are:
+.IP "\-"
+This line matches if the current state is the same as the label on
+this line, or if the current state is ``run,'' the initial state.
+This is also the default state if this field is empty.
+.IP "+"
+This line matches if the current state is ``run.''
+.IP "*"
+This line always matches.
+.IP "label"
+This line matches if the current state is the specified ``label.''
+.IP "\-label"
+This line matches if the current state is not the specified ``label.''
+.PP
+The third field specifies a shell command that is invoked if this line matches.
+Do not use any shell filename expansion characters such as ``*'', ``?'',
+or ``['' (even quoted, they're not likely to work as intended).
+If the command succeeds, as indicated by its exit status, it is expected
+to have printed a single integer to standard output.
+This gives the value of this control line, to be used below.
+If the command fails, the line is ignored.
+The command is executed with its current directory set to the news spool
+directory,
+.\" =()<.IR @<_PATH_SPOOL>@ .>()=
+.IR /var/spool/news/spool .
+.PP
+The fourth field specifies the operator to use to test the value returned above.
+It should be one of the two letter numeric test operators defined in
+.IR test (1)
+such as ``eq'', ``lt'' and the like.
+The leading dash (`'\-'') should not be included.
+.PP
+The fifth field specifies a constant with which to compare the value using
+the operator just defined.
+This is done by invoking the command
+.RS
+test value -operator constant
+.RE
+The line is said to ``succeed'' if it returns true.
+.PP
+The sixth field specifies what should be done if the line succeeds,
+and in some cases if it fails.
+Any of the following words may be used:
+.IP throttle
+Causes
+.I innwatch
+to throttle the server if this line succeeds.
+It also sets the state to the value of the line's label.
+If the line fails, and the state was previously equal to
+the label on this line (that is, this line had previously succeeded),
+then a
+.I go
+command will be sent to the server, and
+.I innwatch
+will return to the ``run'' state.
+The ``throttle'' is only performed if the current state is ``run'' or a
+state other than the label of this line, regardless of whether the command
+succeeds.
+.IP pause
+Is identical to ``throttle'' except that the server is paused.
+.IP shutdown
+Sends a ``shutdown'' command to the server.
+It is for emergency use only.
+.IP flush
+Sends a ``flush'' command to the server.
+.IP go
+Causes
+.I innwatch
+to send a ``go'' command to the server and to set the state to ``run.''
+.IP exit
+Causes
+.I innwatch
+to exit.
+.PP
+.IP skip
+The result of the control file is skipped for the current pass.
+.PP
+The last field specifies the reason that is used in those
+.I ctlinnd
+commands that require one.
+More strictly, it is part of the reason \(em
+.I innwatch
+appends some information to it.
+In order to enable other sites to recognize the state of the local
+.I innd
+server, this field should usually be set to one of several standard
+values.
+Use ``No\ space'' if the server is rejecting articles because of a lack
+of filesystem resources.
+Use ``loadav'' if the server is rejecting articles because of a lack
+of CPU resources.
+.PP
+Once
+.I innwatch
+has taken some action as a consequence of its control line, it skips the
+rest of the control file for this pass.
+If the action was to restart the server (that is, issue a ``go'' command),
+then the next pass will commence almost immediately, so that
+.I innwatch
+can discover any other condition that may mean that the server should
+be suspended again.
+.SH EXAMPLES
+.RS
+.nf
+@@@df .|awk 'NR==2 {print $4}'@lt@10000@throttle@No space
+@@@df -i .|awk 'NR==2 {print $4}'@lt@1000@throttle@No space (inodes)
+.fi
+.RE
+.PP
+The first line causes the server to be throttled if the free space drops
+below 10000 units
+(using whatever units
+.I df
+uses), and restarted again when free space increases above the threshold.
+.PP
+The second line does the same for inodes.
+.PP
+The next three lines act as a group and should
+appear in the following order.
+It is easier to explain them, however, if they are described from the last up.
+.RS
+.nf
+!load!load hiload!loadavg!lt!5!go!
+:hiload:+ load:loadavg:gt:8:throttle:loadav
+/load/+/loadavg/ge/6/pause/loadav
+.fi
+.RE
+The final line causes the server to be paused if
+.I innwatch
+is in the ``run'' state and the load average rises to, or above, six.
+The state is set to ``load'' when this happens.
+The previous line causes the server to be throttled when
+.I innwatch
+is in the ``run'' or ``load'' state, and the load average rises above eight.
+The state is set to ``hiload'' when this happens.
+Note that
+.I innwatch
+can switch the server from ``paused'' to ``throttled'' if the load average
+rises from below six to between six and seven, and then to above eight.
+The first line causes the server to be sent a ``go'' command if
+.I innwatch
+is in the ``load'' or ``hiload'' state, and the load average drops below five.
+.PP
+Note that all three lines assume a mythical command
+.I loadavg
+that is assumed to print the current load average as an integer.
+In more practical circumstances, a pipe of
+.I uptime
+into
+.I awk
+is more likely to be useful.
+.SH BUGS
+This file must be tailored for each individual site, the sample supplied
+is truly no more than a sample.
+The file should be ordered so that the more common problems are tested first.
+.PP
+The ``run'' state is not actually identified by the label with that three
+letter name, and using it will not work as expected.
+.PP
+Using an ``unusual'' character for the delimiter such as ``('', ``*'',
+``&'', ``\(ga'', ``\(aa'', and the like, is likely to lead to obscure and
+hard to locate bugs.
+.SH HISTORY
+Written by <kre@munnari.oz.au> for InterNetNews.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: innwatch.ctl.5,v 1.3 1993/01/29 16:42:58 rsalz Exp $
+.SH "SEE ALSO"
+innd(8),
+ctlinnd(8),
+news.daily(8).
diff --git a/usr/src/contrib/news/inn/doc/innxmit.8 b/usr/src/contrib/news/inn/doc/innxmit.8
new file mode 100644 (file)
index 0000000..ce69244
--- /dev/null
@@ -0,0 +1,163 @@
+.\" $Revision: 1.12 $
+.TH INNXMIT 8
+.SH NAME
+innxmit \- send Usenet articles to a remote NNTP server
+.SH SYNOPSIS
+.I innxmit
+[
+.BI \-A " alt_spool"
+]
+[
+.B \-a
+]
+[
+.B \-d
+]
+[
+.B \-M
+]
+[
+.B \-r
+]
+[
+.BI \-t " timeout"
+]
+[
+.BI \-T " timeout"
+]
+[
+.B \-p
+]
+[
+.B \-S
+]
+.I host
+.I file
+.SH DESCRIPTION
+.I Innxmit
+connects to the NNTP server at the specified
+.I host
+and sends it the articles specified in the batchfile named
+.IR file .
+It is normally invoked by a script run out of
+.IR cron (8)
+that uses
+.IR shlock (1)
+to lock the host name, followed by a
+.IR ctlinnd (8)
+command to flush the batchfile.
+.PP
+.I Innxmit
+normally blocks until the connection is made.
+To specify a timeout on how long to try to make the connection, use the ``\-t''
+flag.
+To specify the total amount of time that should be allowed for article
+transfers, use the ``\-T'' flag.
+The default is to wait until an I/O error occurs, or all the articles have
+been transferred.
+If the ``\-T'' flag is used, the time is checked just before an article
+is started; it will not abort a transfer that is in progress.
+Both values are measured in seconds.
+.PP
+If the
+.I file
+is not an absolute pathname, it is taken relative to the
+.\" =()<.I @<_PATH_BATCHDIR>@>()=
+.I /var/spool/news/out.going
+directory.
+It is normally written by specifying the ``Wnm'' flags in the
+.IR newsfeeds (5)
+file.
+Each line in the batchfile should be in one of the following formats:
+.RS
+.nf
+filename Message-ID
+filename
+.fi
+.RE
+.PP
+The
+.I filename
+field names the article to be sent.
+If it is not an absolute pathname it is taken relative to the news
+spool directory,
+.\" =()<.IR @<_PATH_SPOOL>@ .>()=
+.IR /var/spool/news/spool .
+If the
+.I Message-ID
+field is not specified, it will be obtained by scanning the article.
+The
+.I filename
+and
+.I Message-Id
+fields are separated by a space.
+.PP
+If a communication error such as a
+.IR write (2)
+failure occurs,
+.I innxmit
+will stop sending and rewrite the batchfile to contain the current
+article and any other unsent articles.
+.PP
+If the remote server sends an unexpected reply code,
+.I innxmit
+will requeue the article and proceed.
+Use the ``\-r'' flag if the article should not be requeued.
+.PP
+Upon exit,
+.I innxmit
+reports transfer and CPU usage statistics via
+.IR syslog (3).
+If the ``\-v'' flag is used, they will also be printed on the standard
+output.
+If all articles were sent successfully,
+.I innxmit
+will remove the batchfile, otherwise it will rewrite it to contain the
+list of unsent articles.
+If no articles were sent or rejected, the file is left untouched.
+This can cause the batchfile to grow excessively large if many articles
+have been expired and there are communication problems.
+To always rewrite the batchfile, use the ``\-a'' flag.
+If the ``\-p'' flag is given, then no connection is made and the batchfile
+is purged of entries that refer to files that no longer exist.
+This implies the ``\-a'' flag.
+.PP
+If the ``\-S'' flag is given, then
+.I innxmit
+will offer articles to the specified host using the
+.I "``xreplic''"
+protocol extension described in
+.IR innd (8).
+To use this flag, the input file must contain the history data (commas
+are transliterated to spaces by the server).
+In order for this flag to be used, the input must contain the necessary
+history entries.
+This is usually done by setting up a ``WnR'' entry in the
+.I newsfeeds
+file.
+.PP
+Use the ``\-d'' flag to print debugging information on standard error.
+This will show the protocol transactions between
+.I innxmit
+and the NNTP server on the remote host.
+.PP
+If the ``\-M'' flag is used then
+.I innxmit
+will scan an article's headers before sending it.
+If the article appears to be a MIME article that is not in seven-bit
+format, the article will be sent in ``quoted-printable'' form.
+.PP
+The ``\-A'' flag may be used to specify an alternate spool directory to
+use if the article is not found; this would normally be an NFS-mounted
+spool directory of a master server with longer expiration times.
+.SH HISTORY
+Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: innxmit.8,v 1.12 1993/03/18 21:03:40 rsalz Exp $
+.SH "SEE ALSO"
+ctlinnd(8),
+innd(8),
+newsfeeds(5),
+shlock(1).
diff --git a/usr/src/contrib/news/inn/doc/libinn.3 b/usr/src/contrib/news/inn/doc/libinn.3
new file mode 100644 (file)
index 0000000..d0b49de
--- /dev/null
@@ -0,0 +1,542 @@
+.\" $Revision: 1.20 $
+.TH LIBINN 3
+.SH NAME
+libinn \- InterNetNews library routines
+.SH SYNOPSIS
+.nf
+.ta \w'    unsigned long    'u
+.B
+#include "libinn.h"
+
+.B "typedef struct _TIMEINFO {"
+.B "    time_t time;"
+.B "    long   usec;"
+.B "    long   tzone;
+.B "} TIMEINFO;"
+
+.B "char *"
+.B "GenerateMessageID()"
+
+.B "void"
+.B "HeaderCleanFrom(from)"
+.B "    char   *from;"
+
+.B "char *"
+.B "HeaderFind(Article, Header, size)"
+.B "    char   *Article;"
+.B "    char   *Header;"
+.B "    int    size;"
+
+.B "FILE *"
+.B "CAopen(FromServer, ToServer)"
+.B "    FILE   *FromServer;"
+.B "    FILE   *ToServer;"
+
+.B "FILE *"
+.B "CAlistopen(FromServer, ToServer, request)"
+.B "    FILE   *FromServer;"
+.B "    FILE   *ToServer;"
+.B "    char   *request;"
+
+.B "void"
+.B "CAclose()"
+
+.B "struct _DDHANDLE *"
+.B "DDstart(FromServer, ToServer)"
+.B "    FILE   *FromServer;"
+.B "    FILE   *ToServer;"
+
+.B "void"
+.B "DDcheck(h, group)"
+.B "    DDHANDLE       *h;"
+.B "    char   *group;"
+
+.B "char *"
+.B "DDend(h)"
+.B "    DDHANDLE       *h;"
+
+.B "void"
+.B "CloseOnExec(fd, flag)"
+.B "    int    fd;"
+.B "    int    flag;"
+
+.B "int"
+.B "SetNonBlocking(fd, flag)"
+.B "    int    fd;"
+.B "    int    flag;"
+
+.B "int"
+.B "LockFile(fd, flag)"
+.B "    int    fd;"
+.B "    int    flag;"
+
+.B "char *"
+.B "GetConfigValue(value)"
+.B "    char   *value;"
+
+.B "char *"
+.B "GetFileConfigValue(value)"
+.B "    char   *value;"
+
+.B "char *"
+.B "GetFQDN()"
+
+.B "char *"
+.B "GetModeratorAddress(group)"
+.B "    char   *group;"
+
+.B "int"
+.B "GetResourceUsage(usertime, systime)"
+.B "    double *usertime;"
+.B "    double *systime;"
+
+.B "int"
+.B "GetTimeInfo(now)"
+.B "    TIMEINFO       *now;"
+
+.B "int"
+.B "NNTPlocalopen(FromServerp, ToServerp, errbuff)"
+.B "    FILE   **FromServerp;"
+.B "    FILE   **ToServerp;"
+.B "    char   *errbuff;"
+
+.B "int"
+.B "NNTPremoteopen(FromServerp, ToServerp, errbuff)"
+.B "    FILE   **FromServerp;"
+.B "    FILE   **ToServerp;"
+.B "    char   *errbuff;"
+
+.B "int"
+.B "NNTPconnect(host, FromServerp, ToServerp, errbuff)"
+.B "    char   *host;"
+.B "    FILE   **FromServerp;"
+.B "    FILE   **ToServerp;"
+.B "    char   *errbuff;"
+
+.B "int"
+.B "NNTPcheckarticle(text)"
+.B "    char   *text;"
+
+.B "int"
+.B "NNTPsendarticle(text, ToServer, Terminate)"
+.B "    char   *text;"
+.B "    FILE   *ToServer;"
+.B "    int    Terminate;"
+
+.B "int"
+.B "NNTPsendpassword(server, FromServer, ToServer)"
+.B "    char   *server;"
+.B "    FILE   *FromServer;"
+.B "    FILE   *ToServer;"
+
+.B "void"
+.B "Radix32(value, p)
+.B "    unsigned long  value;"
+.B "    char   *p;"
+
+.B "char *"
+.B "ReadInFile(name, Sbp)"
+.B "    char   *name;"
+.B "    struct stat    *Sbp;"
+
+.B "char *"
+.B "ReadInDescriptor(fd, Sbp)"
+.B "    int    fd;"
+.B "    struct stat    *Sbp;"
+
+.B "char *"
+.B "INNVersion()"
+.fi
+.SH DESCRIPTION
+.I Libinn
+is a library of utility routines for manipulating Usenet articles and
+related data.
+It is not necessary to use the header file
+.IR libinn.h ;
+if it is not available, it is only necessary to properly declare the
+.I TIMEINFO
+datatype, as given above.
+.PP
+.I GenerateMessageID
+uses the current time, process-ID, and fully-qualified domain name of the
+local host to create a Message-ID header that is highly likely to be unique.
+The returned value points to static space that is reused on subsequent calls.
+.PP
+.I HeaderCleanFrom
+removes the extraneous information from the value of a ``From'' or ``Reply-To''
+header and leaves just the official mailing address.
+In particular, the following transformations are made to the
+.I from
+parameter:
+.RS
+.nf
+.ta \w'stuff <address>  'u
+address        -->  address
+address (stuff)        -->  address
+stuff <address>        -->  address
+.fi
+.RE
+The transformations are simple, based on RFC\ 1036 which limits the format
+of the header.
+.PP
+.I HeaderFind
+searches through
+.I Article
+looking for the specified
+.IR Header .
+.I Size
+should be the length of the header name.
+It returns a pointer to the value of the header, skipping leading whitespace,
+or NULL if the header cannot be found.
+.I Article
+should be a standard C string containing the text of the article; the end
+of the headers is indicated by a blank line \(em two consecutive \en
+characters.
+.PP
+.I CAopen
+and
+.I CAclose
+provide news clients with access to the active file; the ``CA'' stands for
+.IR C lient
+.IR A ctive.
+.I CAopen
+opens the
+.IR active (5)
+file for reading.
+It returns a pointer to an open FILE, or NULL on error.
+If a local or NFS-mounted copy exists,
+.I CAopen
+will use that file.
+The
+.I FromServer
+and
+.I ToServer
+parameters should be FILE's connected to the NNTP server for input and
+output, respectively.
+See
+.I NNTPremoteopen
+or
+.IR NNTPlocalopen ,
+below.
+If either parameter is NULL, then
+.I CAopen
+will just return NULL if the file is not locally available.
+If they are not NULL,
+.I CAopen
+will use them to query the NNTP server using
+the ``list'' command to make a local temporary copy.
+.PP
+The
+.I CAlistopen
+sends a ``list'' command to the server and returns a temporary file
+containing the results.
+The
+.I request
+parameter, if not NULL, will be sent as an argument to the command.
+Unlike
+.IR CAopen ,
+this routine will never use a locally-available copy of the active file.
+.PP
+.I CAclose
+closes the active file and removes any temporary file that might have
+been created by
+.I CAopen
+or
+.IR CAlistopen .
+.PP
+.I CloseOnExec
+can make a descriptor ``close-on-exec'' so that it is not shared
+with any child processes.
+If the flag is non-zero, the file is so marked; if zero, the ``close-on-exec''
+mode is cleared.
+.PP
+.IR DDstart ,
+.IR DDcheck ,
+and
+.I DDend
+are used to set the Distribution header; the ``DD'' stands for
+.IR D efault
+.IR D istribution.
+The
+.IR distrib.pats (5)
+file is consulted to determine the proper value for the Distribution
+header after all newsgroups have been checked.
+.I DDstart
+begins the parsing.
+It returns a pointer to an opaque handle that should be used on subsequent
+calls.
+The
+.I FromServer
+and
+.I ToServer
+parameters should be FILE's connected to the NNTP server for input and
+output, respectively.
+If either parameter is NULL, then an empty default will ultimately be returned
+if the file is not locally available.
+.PP
+.I DDcheck
+should be called
+with the handle,
+.IR h ,
+returned by
+.I DDstart
+and a newgroups,
+.IR group ,
+to check.
+It can be called as often as necessary.
+.PP
+.I DDend
+releases any state maintained in the handle and returns an allocated copy
+of the text that should be used for the Distribution header.
+.PP
+.I SetNonBlocking
+enables (if
+.I flag
+is non-zero) or disables (if
+.I flag
+is zero) non-blocking I/O on the indicated descriptor.
+It returns \-1 on failure or zero on success.
+.PP
+.I LockFile
+tries to lock the file descriptor
+.IR fd .
+If
+.I flag
+is non-zero it will block until the lock can be made, otherwise
+it will return \-1 if the file cannot be locked.
+It returns \-1 on failure or zero on success.
+.PP
+.I GetConfigValue
+returns the value of the specified configuration parameter.
+See
+.IR inn.conf (5)
+for details on the parameters and their interpretation.
+The returned value points to static space that is reused on subsequent calls.
+.PP
+.I GetFileConfigValue
+returns the specified configuration parameter from the
+.I inn.conf
+file without checking for any defaults.
+The returned value points to static space that is reused on subsequent calls,
+or NULL if the value is not present.
+.PP
+.I GetFQDN
+returns the fully-qualified domain name of the local host.
+The returned value points to static space that is reused on subsequent calls,
+or NULL on error.
+.PP
+.I GetModeratorAddress
+returns the mailing address of the moderator for specified
+.I group
+or NULL on error.
+See
+.IR moderators (5)
+for details on how the address is determined.
+.I GetModeratorAddress
+does no checking to see if the specified group is actually moderated.
+The returned value points to static space that is reused on subsequent
+calls.
+.PP
+.I GetResourceUsage
+fills in the
+.I usertime
+and
+.I systime
+parameters with the total user and system time used by the current
+process and any children it may have spawned.
+It gets the values by doing a
+.\" =()<.ie '@<RES_STYLE>@'RUSAGE' .ds R$ getrusage>()=
+.ie 'RUSAGE'RUSAGE' .ds R$ getrusage
+.el ds R$ times
+.IR \*(R$ (2)
+system call.
+It returns \-1 on failure, or zero on success.
+.PP
+.I GetTimeInfo
+fills in the
+.I now
+parameter with information about the current time and tzone.
+.\" =()<.ie '@<HAVE_GETTIMEOFDAY>@'DO' \{\>()=
+.ie 'DO'DO' \{\
+The ``time'' and ``usec'' fields will be filled in by a call to
+.IR gettimeofday (2).\}
+.el \{\
+The ``time'' field will be filled in by a call to
+.IR time (2),
+and the ``usec'' field will be set to zero.\}
+The ``tzone'' field will be filled in with the current offset from GMT.
+.\" =()<.ie '@<HAVE_TM_GMTOFF>@'DO' \{\>()=
+.ie 'DONT'DO' \{\
+This is done by calling
+.IR localtime (3)
+and taking the value of the ``tm_gmtoff'' field, negating it, and dividing
+it by 60.\}
+.el \{\
+This is done by calling
+.IR localtime (3)
+and comparing the value with that returned by a call to
+.IR gmtime (3).\}
+For efficiency, the ``tzone'' field is only recalculated if more than an
+hour pass passed since the last time
+.I GetTimeInfo
+has been called.
+This routine returns \-1 on failure, or zero on success.
+.PP
+.I NNTPlocalopen
+.\" =()<.ie '@<HAVE_UNIX_DOMAIN>@'DO' \{\>()=
+.ie 'DO'DO' \{\
+opens a connection to the private port of an InterNetNews server running on
+the local host.
+It returns \-1 on failure, or zero on success.
+.I FromServerp
+and
+.I ToServerp
+will be filled in with FILE's which can be used to communicate
+with the server.
+.I Errbuff
+can either be NULL or a pointer to a buffer at least 512 bytes long.
+If not NULL, and the server refuses the connection, then it will be
+filled in with the text of the server's reply.
+This routine is not for general use.\}
+.el \{\
+is a stub routine, for compatibility with systems that have Unix-domain
+stream sockets.
+It always returns \-1.\}
+.PP
+.I NNTPremoteopen
+does the same except that it calls
+.I GetConfigValue
+to find the name of the local server, and opens a connection to the
+standard NNTP port.
+Any client program can use this routine.
+It returns \-1 on failure, or zero on success.
+.PP
+.I NNTPconnect
+is the same as
+.I NNTPremoteopen
+except that the desired host is given as the
+.I host
+parameter.
+.PP
+.I NNTPcheckarticle
+verifies that the
+.I text
+meets the NNTP limitations on line length.
+It returns \-1 on failure, or zero if the text is valid.
+.PP
+.I NNTPsendarticle
+writes
+.I text
+on
+.I ToServer
+using NNTP conventions for line termination.
+The text should consist of one or more lines ending with a newline.
+If
+.I Terminate
+is non-zero, then the routine will also write the NNTP data-termination
+marker on the stream.
+It returns \-1 on failure, or zero on success.
+.PP
+.I NNTPsendpassword
+sends authentication information to an NNTP server by finding the appropriate
+entry in the
+.IR passwd.nntp (5)
+file.
+.I Server
+contains the name of the host;
+.I GetConfigValue
+will be used if
+.I server
+is NULL.
+.I FromServer
+and
+.I ToServer
+should be FILE's that are connected to the server.
+No action is taken if the specified host is not listed in the password file.
+.PP
+.I Radix32
+converts the number in
+.I value
+into a radix-32 string into the buffer pointed to by
+.IR p .
+The number is split into five-bit pieces and each pieces is converted
+into a character using the alphabet
+.I "0..9a..v"
+to represent the numbers 0..32.
+Only the lowest 32 bits of
+.I value
+are used, so
+.I p
+need only point to a buffer of eight bytes (seven characters and the
+trailing \e0).
+.PP
+.I ReadInFile
+reads the file named
+.I name
+into allocated memory, appending a terminating \e0 byte.
+It returns a pointer to the space, or NULL on error.
+If
+.I Sbp
+is not NULL, it is taken as the address of a place to store the results
+of a
+.IR stat (2)
+call.
+.PP
+.I ReadInDescriptor
+performs the same function as
+.I ReadInFile
+except that
+.I fd
+refers to an already-open file.
+.PP
+.I INNVersion
+returns a pointer to a string identifying the INN version, suitable for
+printing in logon banners.
+.SH EXAMPLES
+.RS
+.nf
+char   *p;
+char   *Article;
+char   buff[256];
+FILE   *F;
+FILE   *ToServer;
+FILE   *FromServer;
+
+if ((p = HeaderFind(Article, "From", 4)) == NULL)
+    Fatal("Can't find From line");
+(void)strcpy(buff, p);
+HeaderCleanFrom(buff);
+
+if ((F = CAopen(FromServer, ToServer)) == NULL)
+    Fatal("Can't open active file");
+
+/* Don't pass the file on to our children. */
+CloseOnExec(fileno(F), 1);
+
+/* Make a local copy. */
+p = ReadInDescriptor(fileno(F), (struct stat *)NULL);
+
+/* Close the file. */
+CAclose();
+
+if (NNTPremoteopen(&FromServer, &ToServer) < 0)
+    Fatal("Can't connect to server");
+
+if ((p = GetModeratorAddress("comp.sources.unix")) == NULL)
+    Fatal("Can't find moderator's address");
+.fi
+.RE
+.SH HISTORY
+Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: libinn.3,v 1.20 1993/01/29 16:43:01 rsalz Exp $
+.SH "SEE ALSO"
+active(5),
+dbz(3z),
+parsedate(3),
+inn.conf(5),
+inndcomm(3),
+moderators(5),
+passwd.nntp(5).
diff --git a/usr/src/contrib/news/inn/doc/moderators.5 b/usr/src/contrib/news/inn/doc/moderators.5
new file mode 100644 (file)
index 0000000..7ba9c52
--- /dev/null
@@ -0,0 +1,58 @@
+.\" $Revision: 1.13 $
+.TH MODERATORS 5
+.SH NAME
+moderators \- mail addresses for moderated Usenet newsgroups
+.SH DESCRIPTION
+The
+.IR GetModeratorAddress (3)
+routine reads the file
+.\" =()<.I @<_PATH_MODERATORS>@>()=
+.I /var/spool/news/data/moderators
+to determine how to reach the moderator of a newsgroup.
+This is used by
+.IR inews (1)
+when an unapproved local posting is made to a moderated newsgroup.
+.PP
+The file is read until a match is found.
+Blank lines and lines starting with a number sign (``#'') are ignored.
+All other lines should consist of two fields separated by a colon.
+.PP
+The first field is a
+.IR wildmat(3) -style
+pattern.
+If it matches the name of the newsgroup, then the second field is taken to
+be a format string for
+.IR sprintf (3).
+This string should have at most one
+.I %s
+parameter, which will be given the name of the newsgroup with periods
+transliterated to dashes.
+.PP
+Here is a sample file:
+.RS
+.nf
+foo.important:announce-request@foo.com
+foo.*:%s@mailer.foo.com
+gnu.*:%s@prep.ai.mit.edu
+*:%s@uunet.uu.net
+.fi
+.RE
+Using the above file, postings to the moderated newsgroup in the left
+column will be sent to the address shown in the right column:
+.RS
+.nf
+.ta \w'gnu.emacs.sources   'u
+foo.important  announce-request@foo.com
+foo.x.announce foo-x-announce@mailer.foo.com
+gnu.emacs.sources      gnu-emacs-sources@prep.ai.mit.edu
+comp.sources.unix      comp-sources-unix@uunet.uu.net
+.fi
+.RE
+.SH HISTORY
+Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: moderators.5,v 1.13 1993/01/29 16:43:02 rsalz Exp $
+.SH "SEE ALSO"
+inews(1), inn.conf(5), libinn(3), wildmat(3).
diff --git a/usr/src/contrib/news/inn/doc/news-recovery.8 b/usr/src/contrib/news/inn/doc/news-recovery.8
new file mode 100644 (file)
index 0000000..2fe1b79
--- /dev/null
@@ -0,0 +1,363 @@
+.\" $Revision: 1.14 $
+.TH NEWS-RECOVERY 8
+.SH NAME
+makeactive, makehistory, newsrequeue \- tools to recover Usenet databases
+.SH SYNOPSIS
+.B makeactive
+[
+.B \-m
+]
+[
+.B \-o
+]
+
+.B makehistory
+[
+.B \-b
+]
+[
+.BI \-f " filename"
+]
+[
+.B \-i
+]
+[
+.B \-n
+]
+[
+.B \-o
+]
+[
+.B \-r
+]
+[
+.BI \-s " size"
+]
+[
+.BI \-T " tmpdir"
+]
+[
+.B \-u
+[
+.B \-v
+]
+]
+
+.B newsrequeue
+[
+.BI \-a " active"
+]
+[
+.BI \-h " history"
+]
+[
+.BI \-d " days"
+]
+[
+.B \-l
+]
+[
+.BI \-n " newsfeeds"
+]
+[
+.I input
+]
+.SH DESCRIPTION
+.I Makeactive
+invokes
+.IR find (1)
+to get a list of all directories in the news spool tree,
+.\" =()<.IR @<_PATH_SPOOL>@ .>()=
+.IR /var/spool/news/spool .
+It discards directories named
+.I lost+found
+as well as those that have a period in them.
+It scans all other directories for all-numeric filenames and determines
+the highest and lowest number.
+The program's output is a set of
+.IR active (5)
+file lines.
+Because there is no way to know if a group is moderated or disabled,
+the fourth field of all entries will be
+.IR y .
+Also, mid-level directories that aren't newsgroups will also created as
+newsgroups with no entries (for example, there is a ``comp.sources.unix''
+group, but no ``comp.sources'').
+.PP
+If the ``\-o'' flag is used,
+.I makeactive
+will read an existing
+.I active
+file for the list of group names and just renumber all groups.
+It will preserve the fourth field of the
+.I active
+file if one is present.
+This is analogous to the
+.IR ctlinnd (8)
+\&``renumber'' command, except that
+.IR innd (8)
+should throttled or not running.
+Do not use this flag with output redirected to the standard active file!
+.PP
+If the ``\-m'' flag is given, then
+.I makeactive
+will attempt to adjust the highest and lowest article numbers wherever
+possible.
+If articles are found in a newsgroup, the numbers will reflect what
+what was found.
+If no articles are found in a newsgroup, the high number from the old
+file will be kept, and the low number will be set to one more then
+the high number.
+This flag may only be used if the ``\-o'' flag is used.
+.PP
+.I Makeactive
+exits with non-zero status if any problems occurred.
+A typical way to use the program is with the following
+.I /bin/sh
+commands:
+.RS
+.DT
+.nf
+ctlinnd throttle "Rebuilding active file"
+.\" =()<.ds R$ @<_PATH_ACTIVE>@>()=
+.ds R$ /var/spool/news/data/active
+.\" =()<TEMP=${TMPDIR-@<_PATH_TMP>@}/act$$>()=
+TEMP=${TMPDIR-/tmp}/act$$
+if [ \-f \*(R$ ] ; then
+    if makeactive \-o >${TEMP} ; then
+        mv ${TEMP} \*(R$
+    f\&i
+else
+    if makeactive >${TEMP} ; then
+        # Edit to restore moderated
+        # and aliased groups.
+        \&.\|.\|.
+        mv ${TEMP} \*(R$
+    f\&i
+f\&i
+ctlinnd reload active "New active file"
+ctlinnd go ''
+.fi
+.RE
+.PP
+.I Makehistory
+rebuilds the
+.IR history (5)
+text file and the associated
+.IR dbz (3)
+database.
+The default name of the text file is
+.\" =()<.IR @<_PATH_HISTORY>@ ;>()=
+.IR /var/spool/news/data/history ;
+to specify a different name, use the ``\-f'' flag.
+.I Makehistory
+scans the
+.IR active (5)
+file to determine which newsgroup directories within the spool directory,
+.\" =()<.IR @<_PATH_SPOOL>@ ,>()=
+.IR /var/spool/news/spool ,
+should be scanned.
+(If a group is removed, but its spool directory still exists,
+.I makehistory
+will ignore it.)
+The program reads each file found and writes a history line for it.
+If the ``\-b'' flag is used, then
+.I makehistory
+will remove any articles that do not have valid Message-ID headers in them.
+.PP
+After the text file is written,
+.I makehistory
+will build the
+.I dbz
+database.
+If the ``\-f'' flag is used, then the database files are named
+.I file.dir
+and
+.IR file.pag .
+If the ``\-f'' flag is not used, then a temporary link to the name
+.I history.n
+is made and the database files are written as
+.I history.n.pag
+and
+.IR history.n.dir .
+If the ``\-o'' flag is used, then the link is not made and any existing
+history files are overwritten.
+If the old database exists,
+.I makehistory
+will use it to determine the size of the new database.
+To ignore the old database use the ``\-i'' flag.
+Using the ``\-o'' flag implies the ``\-i'' flag.
+The program will also ignore any old database if the ``\-s'' flag is used
+to specify the approximate number of entries in the new database.
+Accurately specifying the size is an optimization that will create a more
+efficient database.
+(The size should be the estimated eventual size of the file, typically
+the size of the old file.)
+For more information, see the discussion of
+.I dbzfresh
+and
+.I dbzsize
+in
+.IR dbz (3).
+.PP
+If the ``\-u'' flag is given, then
+.I makehistory
+assumes that
+.I innd
+is running.
+It will pause the server while scanning, and then
+send ``addhist'' commands (see
+.IR ctlinnd (8))
+to the server for any article that is not found in the
+.I dbz
+database.
+The command ``makehistory\ \-bu'' is useful after a system crash, to delete
+any mangled articles and bring the article database back into a more
+consistent state.
+If the ``\-v'' flag is used with the ``\-u'' flag, then
+.I makehistory
+will put a copy of all added lines on its standard output.
+.PP
+To scan the spool directory without rebuilding the
+.I dbz
+files, use the ``\-n'' flag.
+If used with ``-u'', the server will not be paused while scanning.
+To just build the
+.I dbz
+files from an existing text file, use the ``\-r'' flag.
+The ``\-i'' or ``\-s'' flags can be useful if there are no valid
+.I dbz
+files to use.
+A typical way to use this program is with the following
+.I /bin/sh
+commands:
+.RS
+.nf
+ctlinnd throttle "Rebuilding history file"
+.\" =()<cd @<_PATH_NEWSLIB>@>()=
+cd /var/spool/news/data
+if makehistory \-n \-f history.n ; then
+    :
+else
+    echo Error creating history file!
+    exit 1
+f\&i
+# The following line can be used to retain expired history
+# It is not necessary for the history file to be sorted.
+# awk 'NF==2 { print; }' <history >>history.n
+# View history file for mistakes.
+if makehistory \-r \-s `wc \-l <history` \-f history.n; then
+    mv history.n history
+    mv history.n.dir history.dir
+    mv history.n.pag history.pag
+f\&i
+ctlinnd go ''
+.fi
+.RE
+.PP
+.I Makehistory
+needs to create a temporary file that contains one line for each article
+it finds, which can become very large.
+This file is created in the
+.\" =()<.I @<_PATH_TMP>@>()=
+.I /tmp
+directory.
+The ``TMPDIR'' environment variable may be used to specify a
+different directory.
+Alternatively, the ``\-T'' flag may be used to specify a temporary directory.
+In addition, the
+.IR sort (1)
+that is invoked during the build writes large temporary files (often to
+.IR /var/tmp
+but see your system manpages).
+If the ``\-T'' flag is used, then the flag and its value will be passed to
+.IR sort .
+On most systems this will change the temporary directory that
+.I sort
+uses.
+if used, this flag and its value will be passed on to the
+.IR sort (1)
+command that is invoked during the build.
+.PP
+.I Makehistory
+does not handle symbolic links.
+If the news spool area is split across multiple partitions, the following
+commands should probably be run before the database is regenerated:
+.RS
+.nf
+.\" =()<cd @<_PATH_SPOOL>@>()=
+cd /var/spool/news/spool
+find . -type l -name '[1-9]*' -print | xargs -t rm
+.fi
+.RE
+Make sure to run the command on all the appropriate partitions!
+.PP
+.I Newsrequeue
+can be used to rewrite batchfiles after a system crash.
+It operates in two modes.
+In the first mode, it first reads the
+.I active
+and
+.IR newsfeeds (5)
+files to determine where the different newsgroups are to be distributed.
+To specify alternate locations for these files, use the ``\-a'' or ``\-n''
+flags.
+It then opens the
+.I history
+database.
+To specify a different file, use the ``\-h'' flag
+.PP
+Once the files are opened,
+.I newsrequeue
+reads from the specified
+.I input
+file, or standard input if no file is specified.
+Each line should have a single Message-ID, surrounded in angle brackets;
+any other text on the line is ignored.
+For example, the history file (or trailing subset of it) is acceptable
+input to the program operating in this mode.
+If the ``\-d'' flag is used, then only articles that were received
+within the specified number of
+.I days
+will be processed.
+.PP
+.I Newsrequeue
+uses the first two fields of the
+.I newsfeed
+entry \(em the sitename and the excludes field, and the patterns and
+distribs field.
+It ignores all flags in the third field except for the ``N'' field, and
+also ignores the fourth field altogether.
+.PP
+The second mode is used if the ``\-l'' flag is used.
+In this mode, it reads from the specified
+.I input
+file, or standard input if no file is specified.
+Each line should look like an
+.I innd
+log entry.
+It parses entries for accepted articles, looks up the Message-ID in the
+history database to get the filename, and then scans the list of
+sites.
+.PP
+In either mode, the output of
+.I newsrequeue
+consists of one line for each article that should be forwarded.
+Each such line contains the Message-ID, the filename, and the list of
+sites that should receive the article.
+The output is suitable for piping into
+.IR filechan (8).
+.SH HISTORY
+Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: news-recovery.8,v 1.14 1993/03/18 21:03:41 rsalz Exp $
+.SH "SEE ALSO"
+active(5),
+ctlinnd(8),
+dbz(3),
+filechan(8),
+history(5),
+innd(8),
+newsfeeds(5).
diff --git a/usr/src/contrib/news/inn/doc/news.daily.8 b/usr/src/contrib/news/inn/doc/news.daily.8
new file mode 100644 (file)
index 0000000..0254d8b
--- /dev/null
@@ -0,0 +1,265 @@
+.TH NEWS.DAILY 8
+.SH NAME
+news.daily \- do regular Usenet system administration
+.SH SYNOPSIS
+.B news.daily
+[
+.B keyword...
+]
+
+.B innwatch
+[
+.BI \-t " sleeptime"
+]
+[
+.BI \-f " controlfile"
+]
+[
+.BI \-l " logfile"
+]
+
+.B expirerm
+.I file
+
+.B inncheck
+[
+.B \-v
+]
+[
+.B \-pedantic
+]
+[
+.B \-perms
+[
+.B \-fix
+]
+]
+[
+.B \-noperms
+]
+[
+.I file...
+]
+.SH DESCRIPTION
+.I News.daily
+performs a number of important Usenet administrative functions.
+This includes producing a status report, removing old news articles, 
+processing log files, rotating the archived log files, renumbering the
+active file, 
+removing any old socket files found in the ``firewall'' directory,
+and collecting the output.
+.I "This program should be run under the news administrator's id, not as root."
+.PP
+By default, 
+.I news.daily
+performs all of its functions and mails the output to the news administrator,
+.\" =()<.IR @<NEWSMASTER>@ .>()=
+.IR usenet .
+By specifying ``keywords'' on the command line, it is possible to
+modify the functions performed, as well as change the arguments given to
+.IR expire (8)
+and
+.IR expireover (8).
+.PP
+.I News.daily
+should be run once a day, typically out of
+.IR cron (8).
+It may be run more often, but such invocations should at least use the
+\&``norotate'' keyword to prevent the log files from being processed
+and rotated too fast.
+.PP
+The
+.IR shlock (1)
+program is used to prevent simultaneous executions.
+.PP
+The following keywords may be used:
+.TP
+.I delayrm
+This uses the ``\-z'' flag when invoking
+.I expire
+and
+.IR expireover .
+The names of articles to be removed are written to a temporary file, and
+then removed after expiration by calling
+.IR expirerm .
+.TP
+.I nostat
+This keyword disables the status report generated by
+.I innstat
+(see
+.IR newslog (8)).
+Without this keyword, the status report is the first function performed,
+just prior to obtaining the
+.I news.daily
+lock.
+.TP
+.I noexpire
+By default,
+.I expire
+is invoked to remove old news articles.
+Using this keyword disables this function.
+.TP
+.I noexplog
+.I Expire
+normally appends information to
+.\" =()<.I @<_PATH_MOST_LOGS>@/expire.log>()=
+.I /var/spool/news/data/expire.log
+(see
+.IR newslog (5)).
+Using this keyword causes the
+.I expire
+output to be handled as part of 
+.IR news.daily 's
+output.
+It has no effect if the ``noexpire'' keyword is used.
+.TP
+.IR flags= "'expire\ args'"
+By default, 
+.I expire
+is invoked with the an argument of ``\-v1''.
+Using this keyword changes the arguments to those specified.
+Be careful to use quotes if multiple arguments are needed.
+This keyword has no effect if the ``noexpire'' keyword is used.
+.TP
+.I nologs
+After expiration,
+.IR scanlogs (8)
+is invoked to process the log files.
+Using this keyword disables all log processing functions.
+.TP
+.I norotate
+By default, log processing includes rotating and cleaning out log files.
+Using this keyword disables the rotating and cleaning aspect of the log
+processing: the logs files are only scanned for information and no contents
+are altered.
+This keyword has no effect if the ``nologs'' keyword is used.
+.TP
+.I norenumber
+This keyword disables the
+.IR ctlinnd (8)
+renumber operation.
+Normally, the low-water mark for all newsgroups (see
+.IR active (5))
+is reset.
+.TP
+.I norm
+By default, any socket
+.I ctlinnd
+socket that has not been modified for two days will be removed.
+Using this keyword disables this function.
+.TP
+.I nomail
+.I News.daily
+normally sends a mail message containing the results to the administrator.
+Using this keyword causes this message to be sent to stdout and stderr instead.
+Normally, all utilities invoked by the script have their stdout and stderr
+redirected into a file.
+If the file is empty, no message is sent.
+.TP
+.I expireover
+The
+.I expireover
+program is called after expiration to purge the overview databases.
+.TP
+.IR expireoverflags= "'expireover\ args'"
+If the ``expireover'' keyword is used, this keyword may be used to specify
+the flags to be passed to
+.IR expireover .
+If the ``delayrm'' keyword is used, then the default value is ``\-z''
+and the list of deleted files; otherwise, the default value is ``\-s''.
+.TP
+.I /full/path
+The program specified by the given path is executed just before any
+expiration is done.
+A typical use is to specify an alternate expiration program and use the
+\&``noexpire'' keyword.
+Multiple programs may be specified; they will be invoked in order.
+.PP
+The ``norotate'' keyword is passed on to
+.I scanlogs
+if it is invoked.
+.I Expirerm
+is a script that removes a list of files.
+The specified
+.I file
+lists the files.
+It is sorted, and then fed into a pipeline responsible for doing
+the removal, normally
+.IR fastrm (8).
+If there seemed to be a problem removing the files, then mail is sent to
+the news administrator.
+If there were no problems, then
+.I file
+is renamed to
+.\" =()<.I @<_PATH_MOST_LOGS>@/expire.list>()=
+.I /var/spool/news/data/expire.list
+where it is kept (for safety) until the next day's expiration.
+.PP
+.I Innwatch
+is a script that can be started at news boot time.
+It periodically \(em every
+.I sleeptime
+seconds \(em examines the load average, and the number of free blocks
+and inodes on the spool partition, as described by its
+.IR controlfile ,
+.IR innwatch.ctl (5).
+If the load gets too high, or the disk gets too full, it throttles the server.
+When the condition restores, it unblocks the server.
+In addition, on each pass through the loop it will check the specified
+.I logfile
+to see if it has been modified, and send mail to the news administrator
+if so.
+It is usually a good idea to set this to the
+.IR syslog (3)
+file that receives critical news messages.
+Upon receipt of an interrupt signal,
+.IR innwatch
+will report its status in the file
+.\" =()<.IR @<_PATH_INNWSTATUS>@ .>()=
+.IR /var/spool/news/data/innwatch.status .
+.PP
+.I Inncheck
+is a
+.IR perl (1)
+script that verifies the syntax and permissions of all InterNetNews
+configuration files.
+If no
+.I files
+are specified, it checks all files.
+A filename may be followed by an equal sign and a path to indicate
+the pathname to use for the file.
+For example, ``newsfeeds=/tmp/nf'' will check the syntax of a new
+.IR newsfeeds (5)
+without requiring it to be installed.
+If the ``\-v'' flag is used, it prints status information as it checks
+each file.
+If the ``\-pedantic'' flag is used, it checks the files for omissions which
+are not strictly errors, but which might indicate a configuration error.
+.PP
+If any file is specified, only the permissions on those files are checked.
+The ``\-noperms'' flag will suppress this check.
+If the ``\-perms'' flag is used the script verifies the ownership and
+permissions of all files.
+The ``\-fix'' flag can also be used so that the output can be executed
+as a shell script.
+.SH HISTORY
+.I News.daily
+and this manual page written by Landon Curt Noll <chongo@toad.com> and
+Rich $alz <rsalz@uunet.uu.net>.
+.I Inncheck
+written by Brendan Kehoe <brendan@cs.widener.edu> and Rich.
+.I Innwatch
+written by Mike Cooper <mcooper@usc.edu> and <kre@munnari.oz.au>.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: news.daily.8,v 1.6 1993/03/18 21:03:42 rsalz Exp $
+.SH "SEE ALSO"
+active(5),
+ctlinnd(8), 
+expire(8),
+fastrm(8),
+newslog(5),
+newslog(8),
+innwatch.ctl(5),
+shlock(1).
diff --git a/usr/src/contrib/news/inn/doc/nnrp.access.5 b/usr/src/contrib/news/inn/doc/nnrp.access.5
new file mode 100644 (file)
index 0000000..a722014
--- /dev/null
@@ -0,0 +1,105 @@
+.\" $Revision: 1.9 $
+.TH NNRP.ACCESS 5
+.SH NAME
+nnrp.access \- access file for on-campus NNTP sites
+.SH DESCRIPTION
+The file
+.\" =()<.I @<_PATH_NNRPACCESS>@>()=
+.I /var/spool/news/data/nnrp.access
+specifies the access control for those NNTP sites that are not
+handled by the main InterNetNews daemon
+.IR innd (8).
+The
+.IR nnrpd (8)
+server reads it when first spawned by
+.IR innd .
+.PP
+Comments begin with a number sign (``#'') and continue through the end
+of the line.
+Blank lines and comments are ignored.
+All other lines should consist of five fields separated by colons:
+.RS
+.nf
+hosts:perms:username:password:patterns
+.fi
+.RE
+.PP
+The first field is a
+.IR wildmat (3)-style
+pattern specifying the names or Internet address of a set of
+.IR hosts .
+Before a match is checked, the client's hostname (or its Internet
+address if
+.IR gethostbyaddr (3)
+fails)
+is converted to lowercase.
+Each line is matched in turn, and the last successful match is taken
+as the correct one.
+.PP
+The second field is a set of letters specifying the permissions granted
+to the client.
+The
+.I perms
+should be chosen from the following set:
+.RS
+.nf
+R      The client can retrieve articles
+P      The client can post articles
+.fi
+.RE
+.PP
+The third and fourth fields specify the
+.I username
+and
+.I password
+that the client must use to authenticate themselves before the server
+will accept any articles.
+Note that no authentication (other then a matching entry in this file)
+is required for newsreading.
+If they are empty, then no password is required.
+Whitespace in these fields will result in the client being unable
+to properly authenticate themselves and may be used to disable access.
+.PP
+The fifth field is a set of patterns identifying the newsgroups that
+the client is allowed to access.
+The patterns are interpreted in the same manner as the
+.IR newsfeeds (5)
+file.
+The default, however, denies access to all groups.
+.PP
+The access file is normally used to provide host-level access control
+for reading and posting articles.
+There are times, however, when this is not sufficient and user-level access
+control is needed.
+Whenever an NNTP ``authinfo'' command is used, the 
+.I nnrpd
+server re-reads this file and looks for a matching username and password.
+If the local newsreaders are modified to send the ``authinfo'' command,
+then all host entries can have no access and specific users can be granted
+the appropriate read and post access.
+.PP
+For example:
+.RS
+.nf
+##  host:perm:user:pass:groups
+## Default is no access.
+*::  -no-  :  -no-  :!*
+##  FOO hosts have no password, can read anything.
+*.foo.com:Read Post:::*
+##  A related workstation can't access FOO newsgroups.
+lenox.foo.net:RP:martha:hiatt:*,!foo.*
+.fi
+.RE
+.PP
+If the file contains passwords, it should not be world-readable.
+.SH HISTORY
+Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: nnrp.access.5,v 1.9 1992/08/19 16:33:51 rsalz Exp $
+.SH "SEE ALSO"
+innd(8),
+newsfeeds(5),
+nnrpd(8),
+wildmat(3).
diff --git a/usr/src/contrib/news/inn/doc/nntpsend.8 b/usr/src/contrib/news/inn/doc/nntpsend.8
new file mode 100644 (file)
index 0000000..e46cce5
--- /dev/null
@@ -0,0 +1,178 @@
+.TH NNTPSEND 8
+.SH NAME
+nntpsend \- send Usenet articles to remote site
+.SH SYNOPSIS
+.B nntpsend
+[
+.B \-d
+]
+[
+.B \-p
+]
+[
+.B \-r
+]
+[
+.B \-S
+]
+[
+.BI \-s " size"
+]
+[
+.BI \-t " timeout"
+]
+[
+.BI \-T " timelimit"
+]
+[
+.I sitename
+.I fqdn
+] ...
+.SH DESCRIPTION
+.I Nntpsend
+is a front-end that invokes
+.IR innxmit (1)
+to send Usenet articles to a remote NNTP site.
+.PP
+The sites to be fed may be specified by giving
+.I sitename
+.I fqdn
+pairs on the command line.
+If no such pairs are given,
+.I nntpsend
+defaults to the information given in the
+.IR nntpsend.ctl (5)
+config file.
+.PP
+The
+.I sitename
+should be the name of the site as specified in the
+.IR newsfeeds (5) 
+file.
+The 
+.I fqdn 
+should be the hostname or IP address of the remote site.
+.PP
+An
+.I innxmit
+is launched for sites with queued news.
+All
+.I innxmit
+processes are spawned in the background and the script waits for
+them all to finish before returning.
+Output is sent to the file
+.\" =()<.IR @<_PATH_MOST_LOGS>@/nntpsend.log .>()=
+.IR /var/spool/news/data/nntpsend.log .
+In order to keep from overwhelming the local system, 
+.I nntpsend
+waits five seconds before spawned each child.
+The flag ``\-a'' is always given as a flag to
+.IR innxmit .
+.PP
+.I Nntpsend
+expects that the batchfile for a site is named
+.\" =()<.IR @<_PATH_BATCHDIR>@/sitename .>()=
+.IR /var/spool/news/out.going/sitename .
+To prevent batchfile corruption,
+.IR shlock (1)
+is used to ``lock'' these files.
+.PP
+The ``\-p'', ``\-r'', ``\-S'', ``-t'', and ``-T'' flags are passed on to
+the child
+.I innxmit
+program.
+Note that if the ``\-p'' flag is used then no connection is made and
+no articles are fed to the remote site.
+It is useful to have
+.IR cron (8)
+invoke
+.I nntpsend
+with this flag in case a site cannot be reached for an extended period of time.
+.PP
+If the ``\-s'' flag is used, then
+.IR shrinkfile (1)
+will be invoked to perform a tail truncation on the batchfile and the flag
+will be passed to it.
+.PP
+When
+.I sitename
+.I fqdn
+pairs are given on the command line, 
+any flags given on the command completely describe how
+.I innxmit
+and
+.I shrinkfile
+operate.
+When no such pairs are given on the command line, then
+the information found in
+.I nntpsend.ctl
+becomes the default flags for that site.
+Any flags given on the command line override the default flags
+for the site.
+.PP
+For example, with the following control file:
+.RS
+.nf
+nsavax:erehwon.nsavax.gov::-S -t60
+group70:group70.org::
+walldrug:walldrug.com:1m:-T1800 -t300
+.fi
+.RE
+.PP
+The command:
+.RS
+nntpsend
+.RE
+will result in the following:
+.RS
+.nf
+.ta \w'sitename   'u +\w'truncation   'u
+Sitename       Truncation      Innxmit flags
+nsavax (none)  \-a \-S \-t60
+group70        (none)  \-a \-t180
+walldrug       1m      \-a \-T1800 \-t300
+.fi
+.RE
+.PP
+The command:
+.RS
+nntpsend \-d \-T1200
+.RE
+will result in the following:
+.RS
+.nf
+.ta \w'sitename   'u +\w'truncation   'u
+Sitename       Truncation      Innxmit flags
+nsavax (none)  \-a \-d \-S \-T1200 \-t60
+group70        (none)  \-a \-d \-T1200 \-t180
+walldrug       1m      \-a \-d \-T1200 \-t300
+.fi
+.RE
+.PP
+The command:
+.RS
+nntpsend \-s 5m \-T1200 nsavax erehwon.nsavax.gov group70 group70.org
+.RE
+will result in the following:
+.RS
+.nf
+.ta \w'sitename   'u +\w'truncation   'u
+Sitename       Truncation      Innxmit flags
+nsavax 5m      \-a \-T1200 \-t180
+group70        5m      \-a \-T1200 \-t180
+.fi
+.RE
+.PP
+Remember that ``\-a'' is always given, and ``\-t'' defaults to 180.
+.SH HISTORY
+Written by Landon Curt Noll <chongo@toad.com>
+and Rich $alz <rsalz@uunet.uu.net> for InterNetNews.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: nntpsend.8,v 1.3 1992/08/14 20:37:08 rsalz Exp $
+.SH "SEE ALSO"
+innxmit(1), 
+newsfeeds(5),
+nntpsend.ctl(5),
+shrinkfile(1).
diff --git a/usr/src/contrib/news/inn/doc/nntpsend.ctl.5 b/usr/src/contrib/news/inn/doc/nntpsend.ctl.5
new file mode 100644 (file)
index 0000000..23a82ab
--- /dev/null
@@ -0,0 +1,45 @@
+.TH NNTPSEND.CTL 5
+.SH NAME
+nntpsend.ctl \- list of sites to feed via nntpsend
+.SH DESCRIPTION
+The file
+.\" =()<.I @<_PATH_NEWSLIB>@/nntpsend.ctl>()=
+.I /var/spool/news/data/nntpsend.ctl
+specifies the default list of sites to be fed by
+.IR nntpsend (8).
+.PP
+Comments begin with a number sign (``#'') and continue through the end
+of the line.
+Blank lines and comments are ignored.
+All other lines should consist of four fields separated by a colon.
+.PP
+The first field is the name of the site as specified in the
+.IR newsfeeds (5)
+file.
+.PP
+The second field should be the hostname or IP address of the remote site.
+.PP
+The third field, if non-empty, specifies the default tail truncation size of
+site's batchfile.
+This is passed to
+.I shrinkfile
+as the ``\-s'' flag.
+If this field is empty, no truncation is performed.
+.PP
+The fourth field specifies some default flags passed to
+.IR innxmit (8).
+The flag ``\-a'' is always given to
+.I innxmit
+and need not appear hear.
+If no ``\-t timeout'' flag is given in this field and on the
+.I nntpsend
+command line, ``\-t\ 180'' will be given to
+.IR innxmit .
+.SH HISTORY
+Written by Landon Curt Noll <chongo@toad.com> for InterNetNews.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: nntpsend.ctl.5,v 1.4 1993/01/29 16:43:10 rsalz Exp $
+.SH "SEE ALSO"
+innxmit(8), newsfeeds(5), nntpsend(8), trunc(1).
diff --git a/usr/src/contrib/news/inn/doc/overview.fmt.5 b/usr/src/contrib/news/inn/doc/overview.fmt.5
new file mode 100644 (file)
index 0000000..9ea48d0
--- /dev/null
@@ -0,0 +1,45 @@
+.\" $Revision: 1.3 $
+.TH OVERVIEW.FMT 5
+.SH NAME
+overview.fmt \- format of news overview database
+.SH DESCRIPTION
+The file
+.\" =()<.I @<_PATH_SCHEMA>@>()=
+.I /var/spool/news/data/overview.fmt
+specifies the organization of the news overview database.
+Blank lines and lines beginning with a number sign (``#'') are ignored.
+The order of lines in this file is important; it determines the order
+in which the fields will appear in the database.
+.PP
+Most lines will consist of an article header name, optionally
+followed by a colon.
+A trailing set of lines can have the word ``full'' appear after the
+colon; this indicates that the header should appear as well as its value.
+.PP
+If this file is changed, it is usually necessary to rebuild the
+existing overview database using
+.IR expireover (8)
+after removing all existing overview files.
+.PP
+The default file, show below, is compatible with Geoff Collyer's ``nov''
+package:
+.DS
+Subject:
+From:
+Date:
+Message-ID:
+References:
+Bytes:
+Lines:
+##  Some newsreaders get better performance if Xref is present
+#Xref:full
+.DE
+.SH HISTORY
+Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews.
+Intended to be compatible with the
+.I nov
+package written by Geoff Collyer <geoff@world.std.com>.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: overview.fmt.5,v 1.3 1993/03/18 21:03:47 rsalz Exp $
diff --git a/usr/src/contrib/news/inn/doc/passwd.nntp.5 b/usr/src/contrib/news/inn/doc/passwd.nntp.5
new file mode 100644 (file)
index 0000000..fad352e
--- /dev/null
@@ -0,0 +1,52 @@
+.\" $Revision: 1.11 $
+.TH PASSWD.NNTP 5
+.SH NAME
+passwd.nntp \- passwords for connecting to remote NNTP servers
+.SH DESCRIPTION
+The file
+.\" =()<.I @<_PATH_NNTPPASS>@>()=
+.I /var/spool/news/data/passwd.nntp
+contains host-name-password triplets for use when authenticating client
+programs to NNTP servers.
+This file is normally interpreted by the
+.IR NNTPsendpassword
+routine in
+.IR libinn (3).
+Blank lines and lines beginning with a number sign (``#'') are ignored.
+All other lines should consist of three or fields separated by colons:
+.RS
+.nf
+host:name:password
+host:name:password:style
+.fi
+.RE
+.PP
+The first field is the name of a host, and is matched in a case-insensitive
+manner.
+The second field is a user name, and the third is a password.
+The optional fourth field specifies the type of authentication to use.
+The default is ``authinfo'' which means that NNTP ``authinfo''
+commands are used to authenticate to the remote host.
+If either the username or password are empty, then the related command will
+not be sent.
+(The ``authinfo'' command is common extension to RFC 977.)
+.PP
+For example:
+.RS
+.nf
+##  UUNET needs a password, MIT doesn't.
+mit.edu:bbn::authinfo
+uunet.uu.net:bbn:yoyoma:authinfo
+.fi
+.RE
+.PP
+This file should not be world-readable.
+.SH HISTORY
+Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: passwd.nntp.5,v 1.11 1992/08/19 16:33:53 rsalz Exp $
+.SH "SEE ALSO"
+innd(8),
+libinn(3).
diff --git a/usr/src/contrib/news/inn/doc/prunehistory.8 b/usr/src/contrib/news/inn/doc/prunehistory.8
new file mode 100644 (file)
index 0000000..963c410
--- /dev/null
@@ -0,0 +1,97 @@
+.\" $Revision: 1.6 $
+.TH PRUNEHISTORY 8
+.SH NAME
+prunehistory \- remove file names from Usenet history file
+.SH SYNOPSIS
+.B prunehistory
+[
+.BI \-f " filename"
+]
+[
+.B \-p
+]
+[
+.I input
+]
+.SH DESCRIPTION
+.I Prunehistory
+modifies the
+.IR history (5)
+text file to ``remove'' a set of filenames from it.
+The filenames are removed by overwriting them with spaces, so that the
+fize and position of any following entries does not change.
+.PP
+.I Prunehistory
+reads the named
+.I input
+file, or standard input if no file is given.
+The input is taken as a set of lines.
+Blank lines and lines starting with a number sign (``#'') are ignored.
+All other lines are should consist of a Message-ID followed by zero or
+more filenames.
+.I Prunehistory
+will normally complain about lines that do not follow this format.
+If the ``\-p'' flag is used, then the program will silently print any
+invalid lines on its standard output.
+(Blank lines and comment lines are also passed through.)
+This can be useful when
+.I prunehistory
+is used as a filter for other programs such as
+.IR reap .
+.PP
+The Messge-ID is used as the
+.IR dbz (3)
+key to get an offset into the text file.
+If no filenames are mentioned on the input line, then all filenames in
+the text are ``removed.''
+If any filenames are mentioned, they are converted into the history file
+notation.
+If they appear in the line for the specified Message-ID then they are removed.
+.PP
+The default name of the history file is
+.\" =()<.IR @<_PATH_HISTORY>@ ;>()=
+.IR /var/spool/news/data/history ;
+to specify a different name, use the ``\-f'' flag.
+.PP
+Since
+.IR innd (8)
+only appends
+to the text file,
+.I prunehistory
+does not need to have any interaction with it.
+.PP
+It is a good idea to delete purged entries and rebuild the
+.I dbz
+database every so often by using a script like the following:
+.RS
+.nf
+ctlinnd throttle "Rebuilding history database"
+.\" =()<cd @<_PATH_NEWSLIB>@>()=
+cd /var/spool/news/data
+awk 'NF > 2 {
+       printf "%s\et%s\et%s", $1, $2, $3;
+       for (i = 4; i <= NF; i++)
+               printf " %s", $i;
+       print "\en";
+}' <history >history.n
+if makehistory \-r \-f history.n ; then
+    mv history.n history
+    mv history.n.pag history.pag
+    mv history.n.dir history.dir
+else
+    echo 'Problem rebuilding history; old file not replaced'
+f\&i
+ctlinnd go "Rebuilding history database"
+.fi
+.RE
+Note that this keeps no record of expired articles.
+.SH HISTORY
+Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: prunehistory.8,v 1.6 1993/01/29 16:43:12 rsalz Exp $
+.SH "SEE ALSO"
+dbz(3),
+history(5),
+innd(8).
diff --git a/usr/src/contrib/news/inn/doc/rnews.1 b/usr/src/contrib/news/inn/doc/rnews.1
new file mode 100644 (file)
index 0000000..a5e33a3
--- /dev/null
@@ -0,0 +1,122 @@
+.\" $Revision: 1.15 $
+.TH RNEWS 1
+.SH NAME
+rnews \- receive news from a UUCP connection
+.SH SYNOPSIS
+.B rnews
+[
+.BI \-h " host"
+]
+[
+.B \-v
+]
+[
+.B \-U
+]
+[
+.BI \-S " master"
+]
+[
+.I input
+]
+.SH DESCRIPTION
+.I Rnews
+reads messages sent by a downstream UUCP newsfeed and
+sends them to the local InterNetNews server.
+The message is read from the specified input file, or standard input
+if no input is named.
+.PP
+If the ``\-S'' flag is used, then
+.I rnews
+will connect to the specified host.
+If the flag is not used,
+.\" =()<.if '@<RNEWSLOCALCONNECT>@'DO' \{\>()=
+.if 'DO'DO' \{\
+it will try to connect to the server by opening a Unix-domain stream
+connection.
+If that fails,\}
+it will try to open a TCP connection to the default remote server.
+.PP
+If the server is not available, the message is spooled into a new file
+created in the
+.\" =()<.I @<_PATH_SPOOLNEWS>@>()=
+.I /var/spool/news/spool/in.coming
+directory.
+The ``\-U'' flag may be used to send all spooled messages to the
+server once it becomes available again, and can be invoked regularly
+by
+.IR cron (8).
+.PP
+When sent over UUCP, Usenet articles are typically joined in a single
+batch to reduce the UUCP overhead.
+Batches can also be compressed, to reduce the communication time.
+If a message does not start with a number sign (``#'') and an exclamation
+point, then the entire input is taken as a single news article.
+If it does start with with those two characters, then the first line is
+read and interpreted as a batch command.
+.PP
+If the command is ``#! rnews nnn'' where
+.I nnn
+is a number, then the next
+.I nnn
+bytes (starting with the next line) are read as a news article.
+.PP
+If the command is ``#! cunbatch'' then the rest of input is fed to the
+.IR compress (1)
+program with the ``\-d'' flag to uncompress it, and
+the output of this pipe is read as
+.IR rnews 's
+input.
+This is for historical compatibility \(em there is no program named
+.IR cunbatch .
+A compressed batch will start with a ``#! cunbatch'' line, then contain a
+series of articles separated by ``#! rnews nnn'' lines.
+.\" =()<.if '@<RNEWSPROGS>@'DO' \{\>()=
+.if 'DO'DO' \{\
+.PP
+If the command is any other word, then
+.I rnews
+will try to execute a program with that name in the directory
+.\" =()<.IR @<_PATH_RNEWSPROGS>@ .>()=
+.IR /usr/contrib/rnews .
+The batch will be fed into the program's standard input, and the
+standard output will be read back as input into
+.IR rnews .\}
+.\" =()<.if '@<RNEWS_SAVE_BAD>@'DO' \{\>()=
+.if 'DONT'DO' \{\
+.PP
+If
+.I rnews
+detects any problems with an article such as a missing header, or
+an unintelligible reply from the server, it will save a copy of the article
+in the
+.\" =()<.I @<_PATH_BADNEWS>@>()=
+.I /var/spool/news/spool/in.coming/bad
+directory.\}
+If the ``\-v'' flag is used, it will print a notice of all such errors on the
+standard error, naming the input file (if known) and printing the first
+few characters of the input.
+Errors are always logged through
+.IR syslog (3).
+.PP
+If the ``\-h'' flag is given, or failing that, the
+enviroment variable
+.\" =()<.I @<_ENV_UUCPHOST>@>()=
+.I UU_MACHINE
+is set, then
+.I rnews
+will log the Message-ID, and host, for each article offered
+to the server via
+.IR syslog (3).
+Logging will only be done if the value is not an empty string.
+.SH BUGS
+.I Rnews
+cannot process articles that have embedded \e0's in them.
+.SH HISTORY
+Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: rnews.1,v 1.15 1993/01/29 16:43:14 rsalz Exp $
+.SH "SEE ALSO"
+innd(8).
diff --git a/usr/src/contrib/news/inn/doc/shlock.1 b/usr/src/contrib/news/inn/doc/shlock.1
new file mode 100644 (file)
index 0000000..9719df6
--- /dev/null
@@ -0,0 +1,72 @@
+.\" $Revision: 1.7 $
+.TH SHLOCK 1
+.SH NAME
+shlock \- create lock files for use in shell scripts
+.SH SYNOPSIS
+.B shlock
+.BI \-p " pid"
+.BI \-f " name"
+[
+.B \-b
+]
+[
+.B \-u
+]
+[
+.B \-c
+]
+.SH DESCRIPTION
+.I Shlock
+tries to create a lock file named
+.I name
+and write the process ID
+.I pid
+into it.
+If the file already exists,
+.I shlock
+will read the process ID from the file and test to see if the process
+is currently running.
+If the process exists, then the file will not be created.
+.PP
+.I Shlock
+exits with a zero status if it was able to create the lock file, or
+non-zero if the file refers to currently-active process.
+.PP
+Process IDs are normally read and written in ASCII.
+If the ``\-b'' flag is used, then they will be written as a binary
+.IR int .
+For compatibility with other systems, the ``\-u'' flag is accepted as
+a synonym for ``\-b'' since binary locks are used by many UUCP packages.
+.PP
+The following example shows how
+.I shlock
+would be used within a shell script:
+.RS
+.nf
+.\" =()<LOCK=@<_PATH_LOCKS>@/LOCK.send>()=
+LOCK=/var/spool/news/data/LOCK.send
+trap 'rm -f ${LOCK} ; exit 1' 1 2 3 15
+if shlock -p $$ -f ${LOCK} ; then
+    # Do appropriate work
+else
+    echo Locked by `cat ${LOCK}`
+f\&i
+.fi
+.RE
+.PP
+If the ``\-c'' flag is used, then
+.I shlock
+will not create a lock file, but will instead use the file to see if
+the lock is held be another program.
+If the lock is valid, the program will exit with a non-zero status; if
+the lock is not valid (i.e., invoking
+.I shlock
+without the flag would have succeeded), then the program will exit
+with a zero status.
+.SH HISTORY
+Written by Rich $alz <rsalz@uunet.uu.net> after a description of HDB UUCP
+locking given by Peter Honeyman.
+.de R$
+This is revision \\$3, dated \\$4.
+..
+.R$ $Id: shlock.1,v 1.7 1993/01/29 16:43:15 rsalz Exp $
diff --git a/usr/src/contrib/news/inn/include/logging.h b/usr/src/contrib/news/inn/include/logging.h
new file mode 100644 (file)
index 0000000..cc3b1ee
--- /dev/null
@@ -0,0 +1,35 @@
+/*  $Revision: 1.8 $
+**
+**  The logging levels in syslog(3) are confusing.  We use only three,
+**  and give them more meaningful names.  See section 2 in config.dist.
+*/
+#include <syslog.h>
+
+
+/*
+**  2.  LOGGING LEVELS
+*/
+    /* Facility innd should log under. */
+    /* =()<#define LOG_INN_SERVER              @<LOG_INN_SERVER>@>()= */
+#define LOG_INN_SERVER         LOG_NEWS
+    /* Facility all other programs should log under. */
+    /* =()<#define LOG_INN_PROG                @<LOG_INN_PROG>@>()= */
+#define LOG_INN_PROG           LOG_NEWS
+    /* Flags to use in opening the logs; some programs add LOG_PID. */
+    /* =()<#define L_OPENLOG_FLAGS             @<L_OPENLOG_FLAGS>@>()= */
+#define L_OPENLOG_FLAGS                (LOG_CONS | LOG_NDELAY)
+    /* Fatal error, program is about to exit. */
+    /* =()<#define L_FATAL             @<L_FATAL>@>()= */
+#define L_FATAL                LOG_CRIT
+    /* Log an error that might mean one or more articles get lost. */
+    /* =()<#define L_ERROR             @<L_ERROR>@>()= */
+#define L_ERROR                LOG_ERR
+    /* Informational notice, usually not worth caring about. */
+    /* =()<#define L_NOTICE            @<L_NOTICE>@>()= */
+#define L_NOTICE               LOG_WARNING
+    /* A protocol trace. */
+    /* =()<#define L_TRACE             @<L_TRACE>@>()= */
+#define L_TRACE                LOG_DEBUG
+    /* All incoming control commands (ctlinnd, etc). */
+    /* =()<#define L_CC_CMD            @<L_CC_CMD>@>()= */
+#define L_CC_CMD               LOG_INFO
diff --git a/usr/src/contrib/news/inn/include/macros.h b/usr/src/contrib/news/inn/include/macros.h
new file mode 100644 (file)
index 0000000..47510c8
--- /dev/null
@@ -0,0 +1,124 @@
+/*  $Revision: 1.13 $
+**
+**  Here be some useful macros.
+*/
+
+
+/*
+**  Memory allocation.  Wrappers around wrapper functions.
+**  Don't replace any existing definitions, for use with malloc-debug
+**  packages, e.g.
+*/
+#if    defined(_DEBUG_MALLOC_INC)
+#undef _DEBUG_MALLOC_INC
+#include "malloc.h"
+#else
+#define malloc_enter(func)
+#define malloc_leave(func)
+#define malloc_chain_check()
+#define malloc_dump(fd)
+#define malloc_list(a,b,c)
+#define malloc_size(hist)      (*(hist) = 0, 0)
+#endif /* defined(_DEBUG_MALLOC_INC) */
+
+#if    !defined(NEW)
+
+#define NEW(T, c)                      \
+       ((T *)xmalloc((unsigned int)(sizeof (T) * (c))))
+
+#define RENEW(p, T, c)                 \
+        (p = (T *)xrealloc((char *)(p), (unsigned int)(sizeof (T) * (c))))
+
+/* =()<#define DISPOSE(p)              free((@<POINTER>@ *)p)>()= */
+#define DISPOSE(p)             free((void *)p)
+
+    /* This properly belongs in libinn.h. */
+extern int (*xmemfailure)();
+#define ONALLLOCFAIL(func)             (xmemfailure = (func))
+
+#endif /* !defined(NEW) */
+
+
+/*
+**  Copy a string to allocated memory.
+*/
+#define COPY(p)                                \
+       strcpy(NEW(char, strlen(p) + 1), p)
+
+
+/*
+**  Wrappers around str[n]cmp.  Don't add the ((a) == (b)) test here; it's
+**  already been done in places where it's time-critical.
+*/
+#define EQ(a, b)               (strcmp((a), (b)) == 0)
+#define EQn(a, b, n)           (strncmp((a), (b), (SIZE_T)(n)) == 0)
+#define caseEQ(a, b)           (strcasecmp((a), (b)) == 0)
+#define caseEQn(a, b, n)       (strncasecmp((a), (b), (SIZE_T)(n)) == 0)
+
+
+/*
+**  Cast a pointer into another point, but keep lint quiet.
+*/
+#if    !defined(lint)
+#define CAST(t, p)     ((t)(p))
+#else
+#define CAST(t, p)     ((p) ? (t)NULL : (t)NULL)
+#endif /* !defined(lint) */
+
+
+/*
+**  <ctype.h> usually includes \n, which is not what we want.
+*/
+#define ISWHITE(c)                     ((c) == ' ' || (c) == '\t')
+
+
+/*
+**  Get the number of elements in a fixed-size array, or a pointer just
+**  past the end of it.
+*/
+#define SIZEOF(array)  ((int)(sizeof array / sizeof array[0]))
+#define ENDOF(array)   (&array[SIZEOF(array)])
+
+
+/*
+**  Get the length of a string constant.
+*/
+#define STRLEN(string) ((int)(sizeof string - 1))
+
+
+/*
+**  Turn a TIMEINFO into a floating point number.
+*/
+#define TIMEINFOasDOUBLE(t)    \
+    ((double)(t).time + ((double)(t).usec) / 1000000.0)
+
+
+/*
+**  Test data from a stat(2) call to see if it's a file or directory.
+*/
+#if    !defined(S_ISDIR)
+#define S_ISDIR(st_mode)       (((st_mode) & S_IFMT) == S_IFDIR)
+#endif /* !defined(S_ISDIR) */
+#if    !defined(S_ISREG)
+#define S_ISREG(st_mode)       (((st_mode) & S_IFMT) == S_IFREG)
+#endif /* !defined(S_ISREG) */
+
+
+/*
+**  Get the size when binding an AF_UNIX socket.
+*/
+#if    defined(DO_BIND_USE_SIZEOF)
+#define AF_UNIX_SOCKSIZE(S)    (sizeof S)  
+#else
+#define AF_UNIX_SOCKSIZE(S)    (sizeof S.sun_family + strlen(S.sun_path) + 1)
+#endif /* defined(DO_BIND_USE_SIZEOF) */
+
+
+/*
+**  Use a read or recv call to read a descriptor.
+*/
+#if    defined(DO_HAVE_UNIX_DOMAIN)
+#define RECVorREAD(fd, p, s)   recv((fd), (p), (s), 0)
+#else
+#define RECVorREAD(fd, p, s)   read((fd), (p), (s))
+#endif /* defined(DO_HAVE_UNIX_DOMAIN) */
diff --git a/usr/src/contrib/news/inn/samples/checkgroups b/usr/src/contrib/news/inn/samples/checkgroups
new file mode 100644 (file)
index 0000000..668bcb8
--- /dev/null
@@ -0,0 +1,33 @@
+#! /bin/sh
+##  $Revision: 1.13 $
+##  Checkgroups control-message handler.
+
+PROG=checkgroups
+##  Some shells don't pass in $* unless we explicitly pass it in here.
+##  =()<. @<_PATH_PARSECTL>@ "$@">()=
+. /var/spool/news/data/parsecontrol "$@"
+
+case ${ACTION} in
+mail)
+    export FROM CONTROLPROGS NEWSUSER ARTICLE
+    (
+       echo "${FROM} posted the following checkgroups message:"
+       ${SED} -e '/^$/q' -e 's/^/    /' <${ARTICLE}
+       echo ''
+       echo 'If you want to process it, then feed the body of the'
+       echo 'message into docheckgroups while running as the'
+       echo "\"${NEWSUSER}\" userid:"
+       echo ''
+       echo "${CONTROLPROGS}/docheckgroups <<-EOF-"
+       ${SED} -e '1,/^$/d' <${ARTICLE}
+       echo '-EOF-'
+    ) | ${MAILCMD} -s "checkgroups by ${FROM}" ${NEWSMASTER}
+    ;;
+doit)
+    ${SED} -e '1,/^$/d' <${ARTICLE} \
+       | ${CONTROLPROGS}/docheckgroups \
+       | ${WRITELOG} ${LOGFILE} "checkgroups by ${FROM}"
+    ;;
+esac
+
+exit
diff --git a/usr/src/contrib/news/inn/samples/ctlrun b/usr/src/contrib/news/inn/samples/ctlrun
new file mode 100644 (file)
index 0000000..00d4fcd
--- /dev/null
@@ -0,0 +1,58 @@
+#!/bin/sh
+##  $Revision: 1.6 $
+##  Run all control messages named on the command line, or in the spool
+##  directory.
+
+##  =()<. @<_PATH_SHELLVARS>@>()=
+. /var/spool/news/data/innshellvars
+
+INP=${TMPDIR}/inp$$
+TEMP=${TMPDIR}/ctl$$
+case "$#" in
+0)
+    cd ${SPOOL}/control
+    ls
+    ;;
+*)
+    ls $*
+    ;;
+esac >${INP}
+
+cat ${INP} | while read ARTICLE ; do
+    # Get the headers.
+    ${SED} -e '/^$/q' < ${ARTICLE} >${TEMP}
+    # Get the Control line into $1..$9 and check it.
+    set ""`grep '^Control:' <${TEMP}`
+    WHAT=""
+    case "$2" in
+    ihave|sendme|checkgroups|sendsys|senduuname|version|newgroup|rmgroup)
+       WHAT=$2
+       ;;
+    cancel)
+       WHAT=skip
+       ;;
+    esac
+    test "${WHAT}" = "skip" && continue
+
+    # If no control line, try the subject line.
+    if [ -z "${WHAT}" ] ; then
+       # Get the subject line into $1..$9 and check it.
+       set ""`grep '^Subject:' <${TEMP}`
+       test "$2" != "cmsg" && continue
+       case "$3" in
+       ihave|sendme|checkgroups|sendsys|senduuname|version|newgroup|rmgroup)
+           WHAT=$3
+           ;;
+       esac
+    fi
+    test -z "${WHAT}" && continue
+
+    FROM=`grep "^From:" <${TEMP} \
+       | ${SED} -e 's/From:\(.*\)/\1/' -e 's/ (.*)//' -e 's/.*<\(.*\)>/\1/'`
+    test -z "${FROM}" && FROM=${NEWSMASTER}
+    REPLYTO=${FROM}
+
+    ${CONTROLPROGS}/${WHAT} ${FROM} ${REPLYTO} control/${ARTICLE}
+    rm -f ${TEMP}
+done
+rm -f ${INP}
diff --git a/usr/src/contrib/news/inn/samples/default b/usr/src/contrib/news/inn/samples/default
new file mode 100644 (file)
index 0000000..5c8cc67
--- /dev/null
@@ -0,0 +1,22 @@
+#! /bin/sh
+##  $Revision: 1.10 $
+##  Default control-message handler
+
+##  Set prog to null; that will leave the name of the message in $1
+PROG=default
+##  Some shells don't pass in $* unless we explicitly pass it in here.
+##  =()<. @<_PATH_PARSECTL>@ "$@">()=
+. /var/spool/news/data/parsecontrol "$@"
+
+case ${ACTION} in
+mail)
+    ${MAILCMD} -s "Unknown control message by ${FROM}" \
+           ${NEWSMASTER} <${ARTICLE}
+    ;;
+doit|logit)
+    ${WRITELOG} ${LOGFILE} "Unknown control message by ${FROM}" \
+           ${NEWSMASTER} <${ARTICLE}
+    ;;
+esac
+
+exit
diff --git a/usr/src/contrib/news/inn/samples/docheckgroups b/usr/src/contrib/news/inn/samples/docheckgroups
new file mode 100644 (file)
index 0000000..b16572e
--- /dev/null
@@ -0,0 +1,121 @@
+#! /bin/sh
+##  $Revision: 1.4 $
+##  Script to execute checkgroups text; results to stdout.
+
+##  =()<. @<_PATH_SHELLVARS>@>()=
+. /var/spool/news/data/innshellvars
+T=${TMPDIR}
+
+cat /dev/null >${T}/$$out
+
+##  Copy the article without headers, append local newsgroups.
+cat >${T}/$$msg
+test -f ${LOCALGROUPS} && cat ${LOCALGROUPS} >>${T}/$$msg
+
+##  Get the top-level newsgroup names from the message and turn it into
+##  an egrep pattern.
+PATS=`${SED} <${T}/$$msg \
+       -e 's/[         ].*//' -e 's/\..*//' \
+       -e 's/^!//' -e '/^$/d' \
+       -e 's/^/^/' -e 's/$/[.  ]/' \
+    | sort -u \
+    | (tr '\012' '|' ; echo '' )\
+    | ${SED} -e 's/|$//'`
+
+${EGREP} "${PATS}" ${ACTIVE} | ${SED} 's/ .*//' | sort >${T}/$$active
+${EGREP} "${PATS}" ${T}/$$msg | ${SED} 's/[    ].*//' | sort >${T}/$$newsgrps
+
+comm -13 ${T}/$$active ${T}/$$newsgrps >${T}/$$missing
+comm -23 ${T}/$$active ${T}/$$newsgrps >${T}/$$remove
+
+${EGREP} "${PATS}" ${ACTIVE} | ${SED} -n '/ m$/s/ .*//p' | sort >${T}/$$amod.all
+${EGREP} "${PATS}" ${T}/$$msg |
+${SED} -n '/(Moderated)$/s/[   ].*//p' | sort >${T}/$$ng.mod
+
+comm -12 ${T}/$$missing ${T}/$$ng.mod >${T}/$$add.mod
+comm -23 ${T}/$$missing ${T}/$$ng.mod >${T}/$$add.unmod
+cat ${T}/$$add.mod ${T}/$$add.unmod >>${T}/$$add
+
+comm -23 ${T}/$$amod.all ${T}/$$remove >${T}/$$amod
+comm -13 ${T}/$$ng.mod ${T}/$$amod >${T}/$$ismod
+comm -23 ${T}/$$ng.mod ${T}/$$amod >${T}/$$nm.all
+comm -23 ${T}/$$nm.all ${T}/$$add >${T}/$$notmod
+
+if [ -s ${T}/$$remove ] ; then
+    (
+       echo "# The following newsgroups are non-standard."
+       ${SED} "s/^/#   /" ${T}/$$remove
+       echo "# You can remove them by executing the commands:"
+       for i in `cat ${T}/$$remove` ; do
+           echo "      ctlinnd rmgroup $i"
+           ${EGREP} "^$i       " ${NEWSGROUPS} >>${T}/$$ngdel
+       done
+       echo ''
+    ) >>${T}/$$out
+fi
+
+if [ -s ${T}/$$add ] ; then
+    (
+       echo "# The following newsgroups were missing and should be added."
+       ${SED} "s/^/#   /" ${T}/$$add
+       echo "# You can do this by executing the command(s):"
+       for i in `cat ${T}/$$add.unmod` ; do
+           echo "      ctlinnd newgroup $i y ${FROM}"
+           ${EGREP} "^$i       " ${T}/$$msg >>${T}/$$ngadd
+       done
+       for i in `cat ${T}/$$add.mod` ; do
+           echo "      ctlinnd newgroup $i m ${FROM}"
+           ${EGREP} "^$i       " ${T}/$$msg >>${T}/$$ngadd
+       done
+       echo ''
+    ) >>${T}/$$out
+fi
+
+if [ -s ${T}/$$ismod ] ; then
+    (
+       echo "# The following groups are incorrectly marked as moderated:"
+       ${SED} "s/^/#   /" ${T}/$$ismod
+       echo "# You can correct this by executing the following:"
+       for i in `cat ${T}/$$ismod` ; do
+           echo "      ctlinnd changegroup $i y"
+           ${EGREP} "^$i       " ${T}/$$msg >>${T}/$$ngchng
+       done
+       echo ''
+    ) >>${T}/$$out
+fi
+
+if [ -s ${T}/$$notmod ] ; then
+    (
+       echo "# The following groups are incorrectly marked as unmoderated:"
+       ${SED} "s/^/#   /" ${T}/$$notmod
+       echo "# You can correct this by executing the following:"
+       for i in `cat ${T}/$$notmod` ;do
+           echo "      ctlinnd changegroup $i m"
+           ${EGREP} "^$i       " ${T}/$$msg >>${T}/$$ngchng
+       done
+       echo ''
+    ) >>${T}/$$out
+fi
+
+test -s ${T}/$$out && {
+    cat ${T}/$$out
+    echo 'exit # so you can feed this message into the shell'
+    echo "# And remember to update ${NEWSGROUPS}."
+    test -s ${T}/$$ngdel && {
+       echo "# Remove these lines:"
+       ${SED} "s/^/#   /" ${T}/$$ngdel
+       echo ''
+    }
+    test -s ${T}/$$ngadd && {
+       echo "# Add these lines:"
+       ${SED} "s/^/#   /" ${T}/$$ngadd
+       echo ''
+    }
+    test -s ${T}/$$ngchng && {
+       echo "# Change these lines:"
+       ${SED} "s/^/#   /" ${T}/$$ngchng
+       echo ''
+    }
+}
+
+rm -f ${T}/$$*
diff --git a/usr/src/contrib/news/inn/samples/expirerm b/usr/src/contrib/news/inn/samples/expirerm
new file mode 100644 (file)
index 0000000..76796a2
--- /dev/null
@@ -0,0 +1,20 @@
+#! /bin/sh
+##  Remove articles listed by expire -z.
+##  Remove all files specified in the input file.
+
+##  =()<. @<_PATH_SHELLVARS>@>()=
+. /var/spool/news/data/innshellvars
+
+MAIL="${MAILCMD} -s 'Problem removing expired files' ${NEWSMASTER}"
+
+#RMPROC="xargs rm"
+RMPROC="fastrm -e -u -s ${SPOOL}"
+
+eval "cd ${SPOOL} \
+    && ${RMPROC} <$1 \
+    && mv $1 ${MOST_LOGS}/expire.list"
+if [ -f $1 ] ; then
+    echo "Expire had problems removing articles on `hostname`" \
+       | eval ${MAIL}
+    exit 1
+fi
diff --git a/usr/src/contrib/news/inn/samples/ihave b/usr/src/contrib/news/inn/samples/ihave
new file mode 100644 (file)
index 0000000..e6f2766
--- /dev/null
@@ -0,0 +1,30 @@
+#! /bin/sh
+##  $Revision: 1.5 $
+##  Ihave control-message handler
+
+PROG=ihave
+##  Some shells don't pass in $* unless we explicitly pass it in here.
+##  =()<. @<_PATH_PARSECTL>@ "$@">()=
+. /var/spool/news/data/parsecontrol "$@"
+
+case ${ACTION} in
+mail)
+    ${MAILCMD} -s "ihave by ${FROM}" ${NEWSMASTER} <${ARTICLE}
+    ;;
+doit)
+    ##  Scan the message body for articles we don't have.
+    ${SED} -e '1,/^$/d' <${ARTICLE} | grephistory -i >${TEMP}
+    if [ -s ${TEMP} ] ; then
+       export PATHHOST TEMP
+       (
+           echo Newsgroups: to.${PATHHOST}
+           echo Control: sendme `innconfval pathhost`
+           echo ''
+           cat ${TEMP}
+       ) | ${INEWS} -h
+    fi
+    rm -f ${TEMP}
+    ;;
+esac
+
+exit
diff --git a/usr/src/contrib/news/inn/samples/innstat b/usr/src/contrib/news/inn/samples/innstat
new file mode 100644 (file)
index 0000000..825e539
--- /dev/null
@@ -0,0 +1,129 @@
+#! /bin/sh
+##  $Revision: 1.7 $
+##  Display status of INN.
+##  Written by Landon Curt Noll <chongo@toad.com>.
+
+##  =()<. @<_PATH_SHELLVARS>@>()=
+. /var/spool/news/data/innshellvars
+
+SYSLOG_CRIT=news.crit
+SYSLOG_ERR=news.err
+SYSLOG_NOTICE=news.notice
+SYSLOGS="${SYSLOG_CRIT} ${SYSLOG_ERR} ${SYSLOG_NOTICE}"
+
+##  Set up the list of log files.
+LOGS="${SYSLOGS}"
+if [ -f "${MOST_LOGS}/`basename ${ERRLOG}`" ]; then
+    LOGS="${LOGS} `basename ${ERRLOG}`"
+else
+    LOGS="${LOGS} ${ERRLOG}"
+fi
+if [ -f "${MOST_LOGS}/`basename ${LOG}`" ]; then
+    LOGS="${LOGS} `basename ${LOG}`"
+else
+    LOGS="${LOGS} ${LOG}"
+fi
+
+##  Show INND status.
+echo 'Server status:'
+ctlinnd mode 2>&1
+
+##  Show disk usage.  You might have to change this.
+echo ''
+echo 'Disk usage:'
+df ${SPOOL} ${NEWSLIB} ${INCOMING} ${BATCH} ${MOST_LOGS} |
+       grep '/dev/' | sort -u
+
+##  Show size of batch files.
+echo ''
+echo 'Batch file sizes:'
+( cd ${BATCH}; ls -Cs | tail +2 )
+
+##  Show size of log files.
+echo ''
+echo 'Log file sizes:'
+( cd ${MOST_LOGS}; ls -Cs ${LOGS} *.log 2>&1 )
+
+##  Show the lock files
+echo ''
+(      cd ${LOCKS}
+       set -$- LOCK.*
+       if [ -f "$1" ]; then
+               echo 'Lock files:'
+               ls -C LOCK.* 2>&1
+       else
+               echo 'Innwatch is not running'
+       fi
+)
+
+echo ''
+echo 'Server connections:'
+ctlinnd -t60 name '' 2>&1 \
+    | ${SED} -e '/^[    ]*$/d' \
+    | ${AWK} '{print length($0), $0}' \
+    | sort -n \
+    | ${SED} 's/^[0-9][0-9]*  *//' \
+    | ${AWK} '
+BEGIN {
+    linelen = 0;
+}
+{
+    len = length($0);
+    if (len >= 80) {
+       end = "";
+    }
+    else if (len >= 72) {
+       end = "\t\t\t";
+       len += 16 + (8 - len % 8);
+    }
+    else if (len >= 64) {
+       end = "\t";
+       len += (8 - len % 8);
+    }
+    else if (len >= 56) {
+       end = "\t\t";
+       len += 8 + (8 - len % 8);
+    }
+    else if (len >= 48) {
+       end = "\t\t\t";
+       len += 16 + (8 - len % 8);
+    }
+    else if (len >= 40) {
+       end = "\t";
+       len += (8 - len % 8);
+    }
+    else if (len >= 32) {
+       end = "\t";
+       len += (8 - len % 8);
+    }
+    else if (len >= 24) {
+       end = "\t\t";
+       len += 8 + (8 - len % 8);
+    }
+    else if (len >= 16) {
+       end = "\t";
+       len += (8 - len % 8);
+    }
+    else if (len >= 8) {
+       end = "\t\t";
+       len += 8 + (8 - len % 8);
+    }
+    else {
+       end = "\t\t\t";
+       len += 16 + (8 - len % 8);
+    }
+    if (len + linelen > 80) {
+       printf("\n");
+       linelen = len;
+    }
+    else {
+       linelen += len;
+    }
+    printf("%s%s", $0, end);
+}
+END {
+    if (end != "\n") {
+       printf("\n");
+    }
+    printf("\n");
+}'
diff --git a/usr/src/contrib/news/inn/samples/innwatch b/usr/src/contrib/news/inn/samples/innwatch
new file mode 100644 (file)
index 0000000..7bfa03a
--- /dev/null
@@ -0,0 +1,324 @@
+#! /bin/sh
+##  $Revision: 1.11 $
+##  Watch the state of the system relative to the news subsystem.
+##  As controlled by the control file, when space or inodes are almost
+##  exhausted innd is throttled, or paused, similarly if the load is
+##  too high - when conditions revert to normal, innd is restarted.
+##  No logging is done here, watch for syslog reports from innd.
+##  Written by Mike Cooper <mcooper@usc.edu>.
+##  Extensively modified by <kre@munnari.oz.au>.
+##  Watch a log file and send mail when it gets new output by
+##     Steve Groom <stevo@elroy.Jpl.Nasa.Gov>
+##  Steve's extensions merged in innwatch by
+##     <Christophe.Wolfhugel@grasp.insa-lyon.fr>
+
+##  =()<. @<_PATH_SHELLVARS>@>()=
+. /var/spool/news/data/innshellvars
+
+PROGNAME=innwatch
+LOCK=${LOCKS}/LOCK.${PROGNAME}
+DAILY=${LOCKS}/LOCK.news.daily
+##  Where to put the timestamp file (directory and filename).
+TIMESTAMP=${LOCKS}/${PROGNAME}.time
+
+##  Logfile to watch. Comment out if no logwatch.
+LOGFILE=${MOST_LOGS}/news.crit
+
+##  Parse JCL.
+while [ $# -gt 0 ] ; do
+    case X"$1" in
+    X-f)
+       FILE=$2
+       shift
+       ;;
+    X-f*)
+       FILE=`expr "$1" : '-s\(.*\)'`
+       ;;
+    X-l)
+       LOGFILE=$2
+       shift
+       ;;
+    X-l*)
+       LOGFILE=`expr "$1" : '-s\(.*\)'`
+       ;;
+    X-t)
+       SLEEPTIME=$2
+       shift
+       ;;
+    X-t*)
+       SLEEPTIME=`expr "$1" : '-t\(.*\)'`
+       ;;
+    X--)
+       shift
+       break
+       ;;
+    X-*)
+       echo "${PROGNAME}:  Unknown flag $1" 1>&2
+       exit 1
+       ;;
+    *)
+       break
+       ;;
+    esac
+    shift
+done
+
+##  Process arguments.
+if [ $# -ne 0 ] ; then
+    echo "Usage:  ${PROGNAME} [flags]" 1>&2
+    exit 1
+fi
+
+trap '' 2
+
+##  Anyone else there?
+shlock -p $$ -f ${LOCK} || {
+    echo "${PROGNAME}: [$$] locked by [`cat ${LOCK}`]"
+    exit 0
+}
+
+trap 'rm -f ${LOCK} ${WATCHPID} ; exit 1' 1 3 15
+echo "$$" > ${WATCHPID}
+
+##  The reason why we turned INND off, and its, and our current state.
+REASON=''
+INND=''
+STATE=''
+
+trap '(
+       echo "${PROGNAME} waiting for INND to start (pid: $$)"
+       date
+    ) >${INNWSTATUS}' 2
+
+##  We need to remember the process ID of innd, in case one exits
+##  But we need to wait for innd to start before we can do that
+while PID=`cat ${SERVERPID} 2>/dev/null`; test -z "${PID}"; do
+    sleep ${SLEEPTIME}
+done
+
+trap '(
+       if [ -z "${STATE}" ]; then
+           echo "${PROGNAME} state RUN interval ${SLEEPTIME} pid $$"
+       else
+           echo "${PROGNAME} state ${STATE} interval ${SLEEPTIME} pid $$"
+       fi
+       if [ -z "${INND}" ]; then
+           X=GO
+       else
+           X="${INND}"
+       fi
+       test -n "${REASON}" && X="${X}: ${REASON}"
+       echo "INND state ${X}"
+       date
+    ) >${INNWSTATUS}' 2
+
+cd ${SPOOL}
+
+NEXTSLEEP=1
+HASEXITED=false
+
+while { sleep ${NEXTSLEEP} & wait; } ; : ; do
+    NEXTSLEEP=${SLEEPTIME}
+
+    ##  If news.daily is running, idle:  we don't want to change the
+    ##  status of anything while news.daily may be depending on what we
+    ##  have done.
+    test -f "${DAILY}" && continue
+
+    ## Check to see if INND is running.
+    ## Notify NEWSMASTER if it has stopped or just restarted.
+    if ctlinnd -s -t 120 mode 2>/dev/null ; then
+       ${HASEXITED} && {
+           HASEXITED=false
+           ${MAILCMD} -s "INND is now running" ${NEWSMASTER} </dev/null
+       }
+    else
+       ${HASEXITED} || {
+           HASEXITED=true
+           ${MAILCMD} -s "INND is NOT running" ${NEWSMASTER} </dev/null
+       }
+       continue
+    fi
+
+    ##  If innd has exited & restarted, put the new one into the
+    ##  same state the old one was in
+
+    nPID=`cat ${SERVERPID} 2>/dev/null`
+    test -n "${nPID}" -a "${PID}" -ne "${nPID}" && {
+       test -n "${INND}" -a "${INND}" != go && ctlinnd -s "${INND}" "${REASON}"
+       PID="${nPID}"
+    }
+
+    VALUE=0
+    PREVEXP=''
+
+    exec 3<&0
+    exec 0<${CTLWATCH}
+
+    LINE=0
+    while read line ; do
+       LINE=`expr ${LINE} + 1`
+       test -z "$line" && continue
+
+       ##  The first character on the line is the field delimiter,
+       ##  except '#' which marks the line as a comment
+       delim=`expr "${line}" : '\(.\).*'`
+       test "X${delim}" = 'X#' && continue
+
+       ##  Parse the line into seven fields, and assign them to local vars.
+       ##  You're welcome to work out what's going on with quoting in
+       ##  the next few lines if you feel inclined.
+       eval `trap '' 2; echo "${line}" \
+               | ${SED} -e "s/'/'\"'\"'/g" \
+                   -e "s/[     ]*\\\\${delim}[         ]*/\\\\${delim}/g" \
+               | awk -F"${delim}" '{ print     "LAB='"'"'" $2 "'"'"'", \
+                                               "CND='"'"'" $3 "'"'"'", \
+                                               "EXP='"'"'" $4 "'"'"'", \
+                                               "TST='"'"'" $5 "'"'"'", \
+                                               "LIM='"'"'" $6 "'"'"'", \
+                                               "CMD='"'"'" $7 "'"'"'", \
+                                               "CMT='"'"'" $8 "'"'"'" }'`
+
+       ##  If there's no label, the label is the line number.
+       test -z "${LAB}" && LAB=${LINE}
+
+       ##  Should we act on this line?  We will if one (or more) of the
+       ##  specified conditions is satisfied.
+       for X in a b; do        # meaningless trash because we have no goto
+           if [ -z "${CND}" ]; then
+               X=-
+           else
+               X="${CND}"
+           fi
+           set -$- X ${X}; shift
+           for cnd
+           do
+               case "${cnd}" in
+               -)
+                   test -n "${STATE}" -a "X${STATE}" != "X${LAB}" && continue
+                   ;;
+               +)
+                   test -n "${STATE}" && continue
+                   ;;
+               '*')
+                   ;;
+               -*)
+                   test "X-${STATE}" = "X${cnd}" && continue
+                   ;;
+               *)
+                   test "X${STATE}" != "X${cnd}" && continue;
+                   ;;
+               esac
+               break 2;        # OK, continue with this line
+           done
+           continue 2;         # No, skip it.
+       done
+
+       ##  Evaluate the expression, if there is one, and if that works.
+       if [ -z "${EXP}" -o "${EXP}" = "${PREVEXP}" ] \
+        || { PREVEXP="${EXP}"; VALUE=`trap '' 2;eval "${EXP}"`; }; then
+           ##  If innd is running, and test "succeeds", stop it.
+           case "${CMD}" in
+           throttle|pause)
+               OK=n
+               ;;
+           *)
+               OK=y
+               ;;
+           esac
+
+           if [ \( -z "${STATE}" -o "${STATE}" != "${LAB}" -o "${OK}" = y \) \
+                   -a "${VALUE}" "-${TST}" "${LIM}" ] ; then
+               R="${CMT} [${PROGNAME}:${LAB}] ${VALUE} ${TST} ${LIM}"
+               O=
+               case "${CMD}" in
+               throttle)
+                   case "${STATE}" in
+                   ''|go)
+                       REASON="${R}"
+                       ;;
+                   *)
+                       ;;
+                   esac
+                   O="${LAB}"
+                   ARG="${REASON}"
+                   ;;
+               pause)
+                   O="${LAB}"
+                   REASON="${R}"
+                   ARG="${REASON}"
+                   ;;
+               shutdown)
+                   ARG="${R}"
+                   ;;
+               flush)
+                   ARG=''
+                   O="${STATE}"
+                   ARG="${REASON}"
+                   ;;
+               go)
+                   ARG="${REASON}"
+                   NEXTSLEEP=1
+                   REASON=''
+                   ;;
+               exit)
+                   exit 0
+                   ;;
+               *)
+                   break
+                   ;;
+               esac
+
+               ctlinnd -s "${CMD}" "${ARG}" && STATE="${O}" && INND="${CMD}"
+               break
+
+           ##  Otherwise, if innd is not running, and reverse test succeeds
+           ##  restart it.
+           elif [ "${STATE}" = "${LAB}" -a \
+                   \( "${CMD}" = "throttle" -o "${CMD}" = pause \) -a \
+                   ! "${VALUE}" "-${TST}" "${LIM}" ] ; then
+               ctlinnd -s go "${REASON}"
+               STATE=''
+               REASON=''
+               INND=''
+
+               ##  If we have started innd, run all tests again quickly in
+               ##  case there is some other condition that should stop it.
+               NEXTSLEEP=1
+               break
+           fi
+       fi
+
+    done
+
+    exec 0<&3
+    exec 3<&-
+
+    if [ -n "${LOGFILE}" -a -f "${LOGFILE}" ]; then
+       if [ ! -f ${TIMESTAMP} ]; then
+           DOIT=${LOGFILE}
+       else
+           # use ls to print most recently modified file first.
+           # If that's ${LOGFILE}, it's changed since the last pass.
+           DOIT="`ls -t ${TIMESTAMP} ${LOGFILE} | sed -e 1q | grep ${LOGFILE}`"
+       fi
+
+       # If the file has been modified more recently than the timestamp,
+       # and the file has length greater than 0, send the warning.
+       if [ -n "${DOIT}" -a -s ${LOGFILE} ]; then
+           date >${TIMESTAMP}
+           (
+               ls -l ${LOGFILE}
+               echo "-----"
+               ctlinnd -t120 mode
+               echo "-----"
+               cat ${LOGFILE}
+           ) 2>&1 \
+           | ${MAILCMD} -s "${PROGNAME} warning: messages in ${LOGFILE}" \
+               ${NEWSMASTER}
+       fi
+    fi
+
+done
+
+rm -f ${LOCK}
diff --git a/usr/src/contrib/news/inn/samples/innwatch.ctl b/usr/src/contrib/news/inn/samples/innwatch.ctl
new file mode 100644 (file)
index 0000000..8f604a6
--- /dev/null
@@ -0,0 +1,38 @@
+##  $Revision: 1.3 $
+##  innwatch.ctl -- control file for innwatch.
+##  Indicates what to run to test the state of the news system, and what
+##  to do about it.  Format:
+##     !state!when!command!test!limit!command!reason/comment
+##  where
+##     <!>             Delimiter; pick from [,:@;?!]
+##     <state>         State to enter if true.
+##     <when>          States we must be in to match.
+##     <command>       Command to run to test condition.
+##     <test>          Operator to use in test(1) command.
+##     <limit>         Value to test against.
+##     <command>       Command for innwatch to perform; use exit,
+##                     flush, go, pause, shutdown, skip, or throttle.
+##     <reason>        Used in ctlinnd command (if needed).
+
+##  First, just exit innwatch if innd has gone away.
+##  =()<!!! test -f @<_PATH_SERVERPID>@ && echo 0 || echo 1 ! eq ! 1 ! exit ! innd dead>()=
+!!! test -f /var/spool/news/data/innd/innd.pid && echo 0 || echo 1 ! eq ! 1 ! exit ! innd dead
+
+##  Next test the load average.  Above first threshold pause, above higher
+##  threshold throttle, below restart limit undo whatever was done.
+##  =()<!load!load hiload! uptime | tr -d ,. | awk '{ print $(NF - 2) }' ! lt ! @<INNWATCH_LOLOAD>@ ! go ! loadav>()=
+!load!load hiload! uptime | tr -d ,. | awk '{ print $(NF - 2) }' ! lt ! 1000 ! go ! loadav
+##  =()<!hiload!+ load! uptime | tr -d ,. | awk '{ print $(NF - 2) }' ! gt ! @<INNWATCH_HILOAD>@ ! throttle ! loadav>()=
+!hiload!+ load! uptime | tr -d ,. | awk '{ print $(NF - 2) }' ! gt ! 2000 ! throttle ! loadav
+##  =()<!load!+! uptime | tr -d ,. | awk '{ print $(NF - 2) }' ! gt ! @<INNWATCH_PAUSELOAD>@ ! pause ! loadav>()=
+!load!+! uptime | tr -d ,. | awk '{ print $(NF - 2) }' ! gt ! 1500 ! pause ! loadav
+
+##  If load is OK, check space (and inodes) on various filesystems
+##  =()<!!! df . | awk 'NR == 2 { print $4 }' ! lt ! @<INNWATCH_SPOOLSPACE>@ ! throttle ! No space (spool)>()=
+!!! df . | awk 'NR == 2 { print $4 }' ! lt ! 8000 ! throttle ! No space (spool)
+##  =()<!!! df @<_PATH_BATCHDIR>@ | awk 'NR == 2 { print $4 }' ! lt ! @<INNWATCH_BATCHSPACE>@ ! throttle ! No space (newsq)>()=
+!!! df /var/spool/news/out.going | awk 'NR == 2 { print $4 }' ! lt ! 800 ! throttle ! No space (newsq)
+##  =()<!!! df @<_PATH_NEWSLIB>@ | awk 'NR == 2 { print $4 }' ! lt ! @<INNWATCH_LIBSPACE>@ ! throttle ! No space (newslib)>()=
+!!! df /var/spool/news/data | awk 'NR == 2 { print $4 }' ! lt ! 25000 ! throttle ! No space (newslib)
+##  =()<!!! df -i . | awk 'NR == 2 { print $3 }' ! lt ! @<INNWATCH_SPOOLNODES>@ ! throttle ! No space (spool inodes)>()=
+!!! df -i . | awk 'NR == 2 { print $3 }' ! lt ! 200 ! throttle ! No space (spool inodes)
diff --git a/usr/src/contrib/news/inn/samples/makegroup b/usr/src/contrib/news/inn/samples/makegroup
new file mode 100644 (file)
index 0000000..b2ecb19
--- /dev/null
@@ -0,0 +1,152 @@
+#! /bin/sh
+##  $Revision: 1.12 $
+##
+##  Script to add new newsgroups.
+
+##  =()<. @<_PATH_SHELLVARS>@>()=
+. /var/spool/news/data/innshellvars
+
+##  Defaults, edit as appropriate.  Also see where the date is set below.
+DISTRIBUTION=""
+ME=`whoami`
+WHERE=`${INNCONFVAL} fromhost`
+PROGNAME=`basename $0`
+
+case "${WHERE}" in
+*.*)
+    ;;
+*)
+    DOMAIN=`innconfval domain`
+    case "${DOMAIN}" in
+    "No value for*")
+       ;;
+    *)
+       WHERE="${WHERE}.${DOMAIN}"
+       ;;
+    esac
+esac
+
+##  Parse JCL.
+NODIST=true
+COPY=''
+WORD2=''
+TAG=''
+MORETODO=true
+while ${MORETODO} ; do
+    case X"$1" in
+    X-m)
+       MODADDR="$2"
+       WORD2=" moderated"
+       TAG=' (Moderated)'
+       shift
+       ;;
+    X-c)
+       COPY=",$2"
+       shift
+       ;;
+    X-c*)
+       COPY=",`expr "$1" : '-c\(.*\)'`"
+       ;;
+    X-d)
+       DISTRIBUTION="$2"
+       NODIST=false
+       shift
+       ;;
+    X-d*)
+       DISTRIBUTION=`expr "$1" : '-d\(.*\)'`
+       NODIST=false
+       ;;
+    X--)
+       shift
+       MORETODO=false
+       ;;
+    X-*)
+       echo "${PROGNAME}:  Unknown flag $1" 1>&2
+       exit 1
+       ;;
+    *)
+       MORETODO=false
+       ;;
+    esac
+    ${MORETODO} && shift
+done
+if ${NODIST} ; then
+    echo "Usage: ${PROGNAME} -d distrib [-m moderator] [-c copy] group" 1>&2
+    exit 1
+fi
+
+##  Process the argument, the group name.
+case "$#" in
+1)
+    GROUP="$1"
+    ;;
+*)
+    echo "Usage: ${PROGNAME} -d distrib [-m moderator] [-c copy] group" 1>&2
+    exit 1
+    ;;
+esac
+
+##  Set the article date.
+set `date`
+if [ $6 = "DST" ] ; then
+    DATE="$3 $2 $7 $4 $5"
+    YEAR=$7
+else
+    DATE="$3 $2 $6 $4 $5"
+    YEAR=$6
+fi
+NEWTIME="`echo $4 | tr -d :`"
+
+##  Write the article header.
+TEMP=${TMPDIR}/art$$
+cat >${TEMP} <<EOF
+Path: ${WHERE}!${ME}
+Date: ${DATE}
+From: ${ME}@${WHERE}
+Subject: cmsg newgroup ${GROUP}${WORD2}
+Control: newgroup ${GROUP}${WORD2}
+Newsgroups: ${GROUP}.ctl${COPY}
+Message-ID: <${ME}-${GROUP}-${3}-${2}-${YEAR}-${NEWTIME}-${5}@${WHERE}>
+Approved: ${ME}
+Distribution: ${DISTRIBUTION}
+
+EOF
+
+if [ -n "${WORD2}" ] ; then
+    cat >>${TEMP} <<EOF
+This is a moderated newsgroup.
+Local postings will be forwarded to ${MODADDR}.
+
+EOF
+fi
+
+##  Get the group description.
+test -t 0 && {
+    echo 'Enter a one-line description for the newsgroups file:'
+    read LINE
+    echo 'For your newsgroups file:' >>${TEMP}
+    echo "${GROUP}     ${LINE}${TAG}" >>${TEMP}
+    echo "Enter description, terminated with EOF:"
+}
+cat >>${TEMP}
+
+##  Get next command.
+while : ; do
+    echo "Send, abort, or edit?  " | tr -d '\012'
+    read ANS
+    case "$ANS" in
+    e*)
+       ${VISUAL-${EDITOR-vi}} ${TEMP}
+       ;;
+    a*)
+       rm -f ${TEMP}
+       exit 1
+       ;;
+    s*)
+       if ${RNEWS} ${TEMP} ; then
+           rm -f ${TEMP}
+           exit
+       fi
+       ;;
+    esac
+done
diff --git a/usr/src/contrib/news/inn/samples/newgroup b/usr/src/contrib/news/inn/samples/newgroup
new file mode 100644 (file)
index 0000000..4069682
--- /dev/null
@@ -0,0 +1,156 @@
+#! /bin/sh
+##  $Revision: 1.20 $
+##  Newgroup control-message handler
+
+PROG=newgroup
+##  Some shells don't pass in $* unless we explicitly pass it in here.
+##  =()<. @<_PATH_PARSECTL>@ "$@">()=
+. /var/spool/news/data/parsecontrol "$@"
+
+##  Valid parameters and group name?
+case "$#" in
+1|2)
+    ;;
+*)
+    ${WRITELOG} ${LOGFILE} "Unparseable newgroup by ${FROM}" <${ARTICLE}
+    exit
+    ;;
+esac
+case "$1" in
+*[\ \  /:]*)
+    ${WRITELOG} ${LOGFILE} "Unsafe newgroup by ${FROM}" <${ARTICLE}
+    exit
+    ;;
+esac
+
+##  Make sure article is approved.
+${SED} -e '/^$/q' <${ARTICLE} >${TEMP}
+grep '^Approved:' <${TEMP} >/dev/null 2>&1 || {
+    rm -f ${TEMP}
+    ${WRITELOG} ${LOGFILE} "Unapproved newgroup by ${FROM}" <${ARTICLE}
+    exit
+}
+rm -f ${TEMP}
+
+case "$2" in
+[Mm]*)
+    set $1 m
+    ;;
+*)
+    set $1 y
+    ;;
+esac
+
+##  Kill the chefs; from <wesommer@athena.mit.edu>.
+##  That is, turn "alt.foo.bar.bar.bar" into an "x" group.
+#case `echo $1 | awk -F. '{
+#      if (NF > 1 && $NF != "misc") {
+#          if (NF > 5 || $NF == $(NF - 1) || $(NF - 1) == $(NF - 2)) {
+#              print "bozo";
+#          }
+#      }
+#    }'` in
+#bozo*)
+#      set $1 x
+#      ;;
+#esac
+
+##  Compare group against active file.
+SUFFIX=""
+LINE=`grep "^$1 " <${ACTIVE} 2>/dev/null`
+case "${LINE}" in
+"")
+    ##  New group.
+    WORD=created
+    ;;
+"$1 "*" $2")
+    ##  Exact match; ignore it.
+    exit
+    ;;
+"$1 "*" ="*|"$1 "*" x"|"$1 "*" j")
+    ${WRITELOG} ${LOGFILE} "Rejected special newsgroup ($1) by ${FROM}" \
+           <${ARTICLE}
+    exit
+    ;;
+*)
+    case "$2" in
+    m)
+       WORD="made moderated"
+       SUFFIX=" (Moderated)"
+       ;;
+    y)
+       WORD="made unmoderated"
+       ;;
+    esac
+    ;;
+esac
+
+case ${ACTION} in
+mail)
+    P1=$1
+    P2=$2
+    export FROM WORD NEWSBIN P1 P2 ARTICLE
+    (
+       echo "${FROM} requested that $1 be ${WORD}."
+       echo 'To do this, type the following:'
+       echo "  ${NEWSBIN}/ctlinnd newgroup ${P1} ${P2} ${FROM}"
+       echo ''
+       echo 'The original article was:'
+       cat ${ARTICLE}
+    ) | ${WRITELOG} ${LOGFILE} "newgroup $1 $2 ${FROM}"
+    exit
+    ;;
+logit)
+    ${WRITELOG} ${LOGFILE} "skipping newgroup $1 $2 ${FROM} (would be ${WORD})" \
+       <${ARTICLE}
+    exit
+    ;;
+esac
+
+##  Do the work.
+ctlinnd -s newgroup $1 $2 "${FROM}"
+${WRITELOG} ${LOGFILE} "newgroup $1 $2 ${WORD} ${FROM}" <${ARTICLE}
+
+##  Get a description of the newsgroup; first from the article, and
+##  then from the newsgroups file.
+DESC=`${SED} <${ARTICLE} -n -e "
+:top
+/^For your newsgroups file:\$/b scan
+n
+b top
+:scan
+n
+/$1[   ]/ {
+p
+q
+}
+b scan"`
+test -z "${DESC}" && {
+    DESC=`${EGREP} "^$1        " ${NEWSGROUPS} | ${SED} "s/[   ]*(Moderated)//"`
+    test -z "${DESC}" && DESC="$1      ?"
+}
+DESC="${DESC}${SUFFIX}"
+
+##  Lock so we can update newsgroups
+LOCK=${LOCKS}/LOCK.newsgroups
+PID=$$
+TRY=0
+MAXTRY=60
+export LOCK MAXTRY PID LOGFILE TRY
+while [ ${TRY} -lt ${MAXTRY} ]; do
+    shlock -p ${PID} -f ${LOCK} && break
+    sleep 2
+    TRY=`expr ${TRY} + 1`
+done
+
+##  If we got the lock, update the file; otherwise, give up.
+test ${TRY} -lt ${MAXTRY} || {
+    echo "Newgroup cannot update newsgroups.  Locked by" `cat ${LOCK}` 1>&2
+    exit
+}
+
+${EGREP} -v "^$1[      ]" <${NEWSGROUPS} >${TEMP}
+cat ${TEMP} >${NEWSGROUPS}
+echo "${DESC}" >>${NEWSGROUPS}
+rm ${TEMP} ${LOCK}
+exit
diff --git a/usr/src/contrib/news/inn/samples/news.daily b/usr/src/contrib/news/inn/samples/news.daily
new file mode 100644 (file)
index 0000000..316a6f4
--- /dev/null
@@ -0,0 +1,278 @@
+#! /bin/sh
+##  $Revision: 1.22 $
+##  Daily news maintenance.
+##  Optional arguments:
+##     expdir=xxx      Directory in which to build new history file
+##     flags=xxx       Pass xxx flags to expire
+##     noexpire        Do not expire
+##     noexplog        Do not log expire output
+##     nologs          Do not scan logfiles
+##     nomail          Do not capture and mail output
+##     norenumber      Do not renumber the active file
+##     norm            Do not remove certain old files
+##     norotate        Do not rotate logfiles
+##     nostat          Do not run innstat
+##     delayrm         Delay unlink files, then do it quicker (expire -z)
+##     /full/path      Path to a program to run before expiring
+
+##  =()<. @<_PATH_SHELLVARS>@>()=
+. /var/spool/news/data/innshellvars
+
+EXPLOG=${MOST_LOGS}/expire.log
+INNSTAT=${NEWSBIN}/innstat
+MAIL="${MAILCMD} -s 'Daily Usenet report' ${NEWSMASTER}"
+
+##  If your expire does not pause or throttle innd, enable this next line:
+#MESSAGE="Expiration script $$"
+##  Renumber all at once, or in steps?  Set to the delay if steps (that
+##  may take a long time!).
+RENUMBER=
+
+PROGNAME=news.daily
+LOCK=${LOCKS}/LOCK.${PROGNAME}
+
+##  Set defaults.
+DOEXPIRE=true
+DOEXPLOG=true
+DOEXPIREOVER=false
+DOLOGS=true
+DOMAIL=true
+DORENUMBER=true
+DORM=true
+DOSTAT=true
+EXPDIR=
+EXPIREFLAGS="-v1"
+EXPIREOVERFLAGS=
+PROGRAMS=
+REASON=
+RMFILE=
+SCANARG=
+
+##  Parse JCL.
+for I
+do
+    case "X$I" in
+    Xdelayrm)
+       RMFILE=${MOST_LOGS}/expire.rm
+       ;;
+    Xexpdir=*)
+       EXPDIR=`expr "${I}" : 'expdir=\(.*\)'`
+       REASON="Expiring $$ on ${EXPDIR}"
+       ;;
+    Xexpireover)
+       DOEXPIREOVER=true
+       ;;
+    Xexpireoverflags=*)
+       EXPIREOVERFLAGS=`expr "${I}" : 'expireoverflags=\(.*\)'`
+       ;;
+    Xflags=*)
+       EXPIREFLAGS=`expr "${I}" : 'flags=\(.*\)'`
+       ;;
+    Xnoexpire)
+       DOEXPIRE=false
+       ;;
+    Xnoexplog)
+       DOEXPLOG=false
+       ;;
+    Xnologs)
+       DOLOGS=false
+       ;;
+    Xnomail)
+       DOMAIL=false
+       MAIL=cat
+       ;;
+    Xnonn)
+       # Ignore this.
+       ;;
+    Xnorenumber)
+       DORENUMBER=false
+       ;;
+    Xnorm)
+       DORM=false
+       ;;
+    Xnorotate)
+       SCANARG="${SCANARG} norotate"
+       ;;
+    Xnostat)
+       DOSTAT=false
+       ;;
+    X/*)
+       PROGRAMS="${PROGRAMS} ${I}"
+       ;;
+    *)
+       echo "Unknown flag ${I}" 1>&2
+       exit 1
+       ;;
+    esac
+done
+${DOEXPIRE} || {
+    EXPDIR=
+    RMFILE=
+}
+test -n "${EXPDIR}" && EXPIREFLAGS="${EXPIREFLAGS} '-d${EXPDIR}' '-r${REASON}'"
+test -n "${RMFILE}" && {
+    EXPIREFLAGS="${EXPIREFLAGS} -z${RMFILE}"
+    EXPIREOVERFLAGS="${EXPIREOVERFLAGS} -z ${RMFILE}"
+}
+test -z "${EXPIREOVERFLAGS}" && EXPIREOVERFLAGS=-s
+
+if ${DOMAIL} ; then
+    ##  Try to get a temporary file.
+    TEMP=${TMPDIR}/doex$$
+    test -f ${TEMP} && {
+       echo "Temporary file ${TEMP} exists" | eval ${MAIL}
+       exit 1
+    }
+    touch ${TEMP}
+    chmod 0660 ${TEMP}
+    exec 3>&1 >${TEMP} 2>&1
+fi
+
+cd ${NEWSLIB}
+
+##  Show the status of the news system.
+${DOSTAT} && {
+    ${INNSTAT}
+    echo ''
+}
+
+##  Lock out others.
+trap 'rm -f ${LOCK} ; exit 1' 1 2 3 15
+shlock -p $$ -f ${LOCK} || {
+    ( echo "$0: Locked by `cat ${LOCK}`"; ${INNSTAT} ) | eval ${MAIL}
+    exit 1
+}
+
+##  Run any user programs.
+if [ -n "${PROGRAMS}" ] ; then
+    for P in ${PROGRAMS} ; do
+       echo ''
+       echo "${P}:"
+       eval ${P}
+    done
+fi
+
+##  The heart of the matter:  prologs, expire, epilogs.
+if ${DOEXPIRE} ; then
+
+    ## Wait to be fairly certain innwatch is not in the middle of a pass
+    ## Since we're locked, innwatch will pause now till we're done
+    sleep 30
+
+    ##  See if we're throttled for lack of space.
+    SERVERMODE=`ctlinnd mode 2>/dev/null | ${SED} 1q`
+    case "${SERVERMODE}" in
+    'Server paused'*'[innwatch:'*)
+       ## If paused, by innwatch, then turn pause into throttle
+       ## as we're going to stay that way for a while now
+       ctlinnd -s throttle "`expr \"${SERVERMODE}\" : 'Server paused \(.*\)'`"
+    esac
+    case "${SERVERMODE}" in
+    *space*" -- throttling")
+       echo "${SERVERMODE} -- trying to recover"
+       THROTTLED=true
+       EXPIREFLAGS="${EXPIREFLAGS} -n"
+       MESSAGE=
+       ;;
+    *"[innwatch:"*)
+       echo "${SERVERMODE} -- pressing on"
+       THROTTLED=false
+       EXPIREFLAGS="${EXPIREFLAGS} -n"
+       MESSAGE=
+       ;;
+    *)
+       THROTTLED=false
+       ;;
+    esac
+
+    ##  Throttle server if we need to.
+    if [ -n "${MESSAGE}" ] ; then
+       ctlinnd -s -t120 throttle "${MESSAGE}" 2>&1 || {
+           ( echo "$0: Cannot throttle news"; ${INNSTAT} ) | eval ${MAIL}
+           exit 1
+       }
+    fi
+
+    ##  Actual expire the articles (finally!).
+    if ${DOEXPLOG}; then
+       echo "expire begin `date`: (${EXPIREFLAGS})"            >>${EXPLOG}
+       ( exec 2>&1 ; eval expire "${EXPIREFLAGS}" ) \
+           | ${SED} -e 's/^/    /' >>${EXPLOG}
+       echo "    expire end `date`"                            >>${EXPLOG}
+    else
+       eval expire "${EXPIREFLAGS}"
+    fi
+    test -n "${RMFILE}" -a -f "${RMFILE}" && {
+       sort -o ${RMFILE} ${RMFILE}
+       ${DOEXPIREOVER} && {
+           eval expireover "${EXPIREOVERFLAGS}"
+           DOEXPIREOVER=false
+       }
+       expirerm ${RMFILE}
+    }
+    ${DOEXPIREOVER} && eval expireover "${EXPIREOVERFLAGS}"
+
+    ##  If built on another filesystem, move history files.
+    if [ -n "${EXPDIR}" ] ; then
+       if [ ! -f ${EXPDIR}/history.n -o ! -f ${EXPDIR}/history.n.done ] ; then
+           ( echo "$0: No new history files"; ${INNSTAT} ) | eval ${MAIL}
+           exit 1
+       fi
+       mv -f ${EXPDIR}/history.n ${HISTORY}
+       mv -f ${EXPDIR}/history.n.dir ${HISTORY}.dir
+       mv -f ${EXPDIR}/history.n.pag ${HISTORY}.pag
+       rm -f ${EXPDIR}/history.n.done
+       case "${EXPIREFLAGS}" in
+       *-n*)
+           ;;
+       *)
+           MESSAGE="${REASON}"
+           ;;
+       esac
+    fi
+
+    ##  Restart the server if we need to.
+    if ${THROTTLED} || test -n "${MESSAGE}" ; then
+       ctlinnd -s go "${MESSAGE}" 2>&1 || {
+           ( echo "$0: Cannot unthrottle news"; ${INNSTAT} ) | eval ${MAIL}
+           exit 1
+       }
+    fi
+fi
+
+##  Renumber the active file.
+if ${DORENUMBER} ; then
+    echo ''
+    echo 'Renumbering active file.'
+    if [ -z "${RENUMBER}" ] ;then
+       ctlinnd -s -t`wc -l <${ACTIVE}` renumber '' 2>&1
+    else
+       while read GROUP hi lo flag ; do
+           ctlinnd -s renumber ${GROUP} 2>&1
+           sleep ${RENUMBER}
+       done <${ACTIVE}
+    fi
+fi
+
+${DOLOGS} && {
+    echo ''
+    scanlogs ${SCANARG}
+}
+
+##  Remove old sockets.
+${DORM} &&
+    find ${TEMPSOCKDIR} -name "${TEMPSOCK}" -mtime +2 -exec rm -f '{}' ';'
+
+##  Mail the report.
+if ${DOMAIL} ; then
+    # Stop using the temp file, and mail captured output.
+    exec 1>&3 2>&1 3>&-
+    test -s ${TEMP} && cat ${TEMP} | eval ${MAIL}
+    rm -f ${TEMP}
+fi
+
+##  All done; warn if we can't release the lock.
+rm ${LOCK}
+date >${NEWSLIB}/.news.daily
+${RNEWS} -U
+exit 0
diff --git a/usr/src/contrib/news/inn/samples/nntpsend b/usr/src/contrib/news/inn/samples/nntpsend
new file mode 100644 (file)
index 0000000..a688769
--- /dev/null
@@ -0,0 +1,278 @@
+#! /bin/sh
+##  $Revision: 1.8 $
+##  Send news via NNTP by running several innxmit processes in the background.
+##  Usage:
+##     nntpsend [-p][-r][-s size][-S][-t timeout][-T limit][host fqdn]...
+##     -p              Run innxmit with -p to prune batch files
+##     -r              innxmit, don't requeue on unexpected error code
+##     -s size         limit the .nntp file to size bytes
+##     -S              send via xreplic protocol (send to a slave site)
+##     -t timeout      innxmit timeout to make connection (def: 180)
+##     -T limit        innxmit connection transmit time limit (def: forever)
+##     host fqdn       send to host and qualified domain (def: nntpsend.ctl)
+##  If no "host fqdn" pairs appear on the command line, then ${CTLFILE}
+##  file is read.
+##  =()<. @<_PATH_SHELLVARS>@>()=
+. /var/spool/news/data/innshellvars
+
+PROGNAME=`basename $0`
+LOCK=${LOCKS}/LOCK.${PROGNAME}
+CTLFILE=${NEWSLIB}/${PROGNAME}.ctl
+LOG=${MOST_LOGS}/${PROGNAME}.log
+
+##  Set defaults.
+D_FLAG=
+P_FLAG=
+R_FLAG=
+S_FLAG=
+TRUNC_SIZE=
+T_FLAG=
+TIMELIMIT=
+
+##  Parse JCL.
+MORETODO=true
+while ${MORETODO} ; do
+    case X"$1" in
+    X-d)
+       D_FLAG="-d"
+       ;;
+    X-p)
+       P_FLAG="-p"
+       ;;
+    X-r)
+       R_FLAG="-r"
+       ;;
+    X-S)
+       S_FLAG="-S"
+       ;;
+    X-s)
+       if [ -z "$2" ] ; then
+           echo "${PROGNAME}: option requires an argument -- s" 1>&2
+           exit 1
+       fi
+       TRUNC_SIZE="$2"
+       shift
+       ;;
+    X-s*)
+       TRUNC_SIZE="`echo $2 | ${SED} -e 's/-s//'`"
+       ;;
+    X-t)
+       if [ -z "$2" ] ; then
+           echo "${PROGNAME}: option requires an argument -- t" 1>&2
+           exit 1
+       fi
+       T_FLAG="-t$2"
+       shift
+       ;;
+    X-t*)
+       T_FLAG="$1"
+       ;;
+    X-T)
+       if [ -z "$2" ] ; then
+           echo "${PROGNAME}: option requires an argument -- T" 1>&2
+           exit 1
+       fi
+       TIMELIMIT="-T$2"
+       shift
+       ;;
+    X-T*)
+       TIMELIMIT="$1"
+       ;;
+    X--)
+       shift
+       MORETODO=false
+       ;;
+    X-*)
+       echo "${PROGNAME}: illegal option -- $1" 1>&2
+       exit 1
+       ;;
+    *)
+       MORETODO=false
+       ;;
+    esac
+    ${MORETODO} && shift
+done
+
+##  Parse arguments; host/fqdn pairs.
+INPUT=${TMPDIR}/nntpsend$$
+cp /dev/null ${INPUT}
+while [ $# -gt 0 ]; do
+    if [ $# -lt 2 ]; then
+       echo "${PROGNAME}:  Bad host/fqdn pair" 1>&2
+       exit 1
+    fi
+    echo "$1 $2" >>${INPUT}
+    shift
+    shift
+done
+
+##  If nothing specified on the command line, read the control file.
+if [ ! -s ${INPUT} ] ; then
+    if [ ! -r ${CTLFILE} ]; then
+       echo "${PROGNAME}: cannot read ${CTLFILE}"
+       exit 1
+    fi
+    ${SED} -e 's/#.*//' -e '/^$/d' -e 's/::\([^:]*\)$/:max:\1/' \
+       -e 's/:/ /g' <${CTLFILE} >${INPUT}
+fi
+
+##  Go to where the action is.
+if [ ! -d ${BATCH} ]; then
+    echo "${PROGNAME}: directory ${BATCH} not found" 1>&2
+    exit 1
+fi
+cd ${BATCH}
+
+##  Set up log file.
+umask 002
+if [ -z "${D_FLAG}" ]; then
+    test ! -f ${LOG} && touch ${LOG}
+    chmod 0660 ${LOG}
+    exec >>${LOG} 2>&1
+fi
+PPID=$$
+echo "${PROGNAME}: [${PPID}] start"
+
+##  Set up environment.
+export BATCH PROGNAME PPID INNFLAGS
+
+##  Loop over all sites.
+cat ${INPUT} | while read SITE HOST MAXSIZE FLAGS; do
+    ## Parse the input parameters.
+    if [ -z "${SITE}" -o -z "${HOST}" ] ; then
+       echo "Ignoring bad line: ${SITE} ${HOST} ${MAXSIZE} ${FLAGS}" 1>&2
+       continue
+    fi
+    test "${MAXSIZE}" = "max" && MAXSIZE=
+
+    ## Compute the specific parameters for this site.
+    if [ -n "${TRUNC_SIZE}" ]; then
+       SIZE="${TRUNC_SIZE}"
+    else
+       SIZE="${MAXSIZE}"
+    fi
+    D_PARAM=
+    R_PARAM=
+    S_PARAM=
+    TIMEOUT_PARAM=
+    TIMELIMIT_PARAM=
+    if [ -z "${FLAGS}" ]; then
+       MORETODO=false
+    else
+       MORETODO=true
+       set - ${FLAGS}
+    fi
+    while ${MORETODO} ; do
+       case "X$1" in
+       X-a)
+           ;;
+       X-d)
+           D_PARAM="-d"
+           ;;
+       X-p)
+           P_PARAM="-p"
+           ;;
+       X-r)
+           R_PARAM="-r"
+           ;;
+       X-S)
+           S_PARAM="-S"
+           ;;
+       X-t)
+           if [ -z "$2" ] ; then
+               echo "${PROGNAME}: option requires an argument -- t" 1>&2
+               exit 1
+           fi
+           TIMEOUT_PARAM="-t$2"
+           shift
+           ;;
+       X-t*)
+           TIMEOUT_PARAM="$1"
+           ;;
+       X-T)
+           if [ -z "$2" ] ; then
+               echo "${PROGNAME}: option requires an argument -- T" 1>&2
+               exit 1
+           fi
+           TIMELIMIT_PARAM="-T$2"
+           shift
+           ;;
+       X-T*)
+           TIMELIMIT_PARAM="$1"
+           ;;
+       *)
+           MORETODO=false
+           ;;
+       esac
+       ${MORETODO} && shift
+    done
+    INNFLAGS="-a"
+    if [ -n "${D_FLAG}" ]; then
+       INNFLAGS="${INNFLAGS} ${D_FLAG}"
+    else
+       test -n "${D_PARAM}" && INNFLAGS="${INNFLAGS} ${D_PARAM}"
+    fi
+    if [ -n "${P_FLAG}" ]; then
+       INNFLAGS="${INNFLAGS} ${P_FLAG}"
+    else
+       test -n "${P_PARAM}" && INNFLAGS="${INNFLAGS} ${P_PARAM}"
+    fi
+    if [ -n "${R_FLAG}" ]; then
+       INNFLAGS="${INNFLAGS} ${R_FLAG}"
+    else
+       test -n "${R_PARAM}" && INNFLAGS="${INNFLAGS} ${R_PARAM}"
+    fi
+    if [ -n "${S_FLAG}" ]; then
+       INNFLAGS="${INNFLAGS} ${S_FLAG}"
+    else
+       test -n "${S_PARAM}" && INNFLAGS="${INNFLAGS} ${S_PARAM}"
+    fi
+    if [ -n "${T_FLAG}" ]; then
+       INNFLAGS="${INNFLAGS} ${T_FLAG}"
+    else
+       test -n "${TIMEOUT_PARAM}" && INNFLAGS="${INNFLAGS} ${TIMEOUT_PARAM}"
+    fi
+    if [ -n "${TIMELIMIT}" ]; then
+       INNFLAGS="${INNFLAGS} ${TIMELIMIT}"
+    else
+       test -n "${TIMELIMIT_PARAM}" \
+           && INNFLAGS="${INNFLAGS} ${TIMELIMIT_PARAM}"
+    fi
+
+    ##  Start sending this site in the background.
+    export SITE HOST LOCKS BATCHFILE PROGNAME PPID SIZE TMPDIR
+    sh -c '
+       BATCHFILE=${HOST}.nntp
+       LOCK=${LOCKS}/LOCK.${HOST}
+       trap "rm -f ${LOCK} ; exit 1" 1 2 3 15
+       shlock -p $$ -f ${LOCK} || {
+           WHY="`cat ${LOCK}`"
+           echo "${PROGNAME}: [${PPID}:$$] ${HOST} locked ${WHY} `date`"
+           exit
+       }
+       if [ -f ${SITE}.work ] ; then
+           cat ${SITE}.work >>${BATCHFILE}
+           rm -f ${SITE}.work
+       fi
+       mv ${SITE} ${SITE}.work
+       if ctlinnd -s -t30 flush ${SITE} ; then
+           cat ${SITE}.work >>${BATCHFILE}
+           rm -f ${SITE}.work
+           test -n "${SIZE}" && shrinkfile -s${SIZE} -v ${BATCHFILE}
+           if [ -s ${BATCHFILE} ] ; then
+               echo "${PROGNAME}: [${PPID}:$$] begin ${HOST} `date`"
+               echo "${PROGNAME}: [${PPID}:$$] innxmit ${INNFLAGS} ${HOST} ..."
+               eval innxmit ${INNFLAGS} ${HOST} ${BATCH}/${BATCHFILE}
+               echo "${PROGNAME}: [${PPID}:$$] end ${HOST} `date`"
+           else
+               rm -f ${BATCHFILE}
+           fi
+       fi
+       rm -f ${LOCK}
+    ' &
+    sleep 5
+done
+
+wait
+rm -f ${INPUT}
+echo "${PROGNAME}: [${PPID}] stop"
diff --git a/usr/src/contrib/news/inn/samples/parsecontrol b/usr/src/contrib/news/inn/samples/parsecontrol
new file mode 100644 (file)
index 0000000..aa0f8e8
--- /dev/null
@@ -0,0 +1,105 @@
+#! /bin/sh
+##  $Revision: 1.7 $
+##  Initial parsing of control messages.
+
+##  =()<. @<_PATH_SHELLVARS>@>()=
+. /var/spool/news/data/innshellvars
+WRITELOG=${NEWSBIN}/writelog
+
+AZ=ABCDEFGHIJKLMNOPQRSTUVWXYZ
+az=abcdefghijklmnopqrstuvwxyz
+FROM="`echo \"$1\" | tr ${AZ} ${az}`"
+REPLYTO="$2"
+case "$3" in
+"")
+    ARTICLE=/dev/null
+    ;;
+/*)
+    ARTICLE="$3"
+    ;;
+*)
+    ARTICLE="${SPOOL}/$3"
+    ;;
+esac
+PATHHOST="$4"
+
+umask 002
+TEMP=${TMPDIR}/ctl$$
+##  Avoid egrep bugs with empty or-patterns.
+test -z "${PROG}" && PROG=all
+${EGREP} "^(${PROG}|all):" <${CTLFILE} >${TEMP}
+
+##  Get any arguments.
+if grep "^Control:[    ]*${PROG}" <${ARTICLE} >/dev/null 2>&1 ; then
+    set X `${SED} -n -e "s/^Control:[  ]*${PROG}//p" -e '/^$/q' <${ARTICLE}`
+    shift
+else
+    if grep "^Subject:[        ]*cmsg[         ]*${PROG}" \
+               <${ARTICLE} >/dev/null 2>&1 ; then
+       set X `${SED} -n -e "s/^Subject:[       ]*cmsg[         ]*${PROG}//p" \
+               -e '/^$/q' <${ARTICLE}`
+       shift
+    else
+       rm -f ${TEMP}
+       ${MAILCMD} -s "Bad header by ${FROM}" \
+               ${NEWSMASTER} <${ARTICLE}
+       exit
+    fi
+fi
+
+ACTION=mail
+IFS=:
+exec <${TEMP}
+while read MESSAGE FROM_PAT NG_PAT ACT_PAT ; do
+    eval "case \"${FROM}\" in
+    ${FROM_PAT})
+       ##  Got a match -- if newgroup/rmgroup, must also
+       ##  match the newsgroup pattern.
+       case \"${PROG}\" in
+       newgroup|rmgroup)
+           case \"$1\" in
+           ${NG_PAT})
+               ACTION=${ACT_PAT}
+               ;;
+           esac
+           ;;
+       *)
+           ACTION=${ACT_PAT}
+           ;;
+       esac
+    ;;
+    esac"
+done
+rm -f ${TEMP}
+IFS="`echo stn | tr stn ' \011\012'`"
+
+LOGFILE=mail
+case ${ACTION} in
+drop)
+    exit
+    ;;
+log)
+    echo "`date` Ignored ${PROG} ${ARTICLE} by ${FROM} (${PATHHOST})" 1>&2
+    exit
+    ;;
+log=*)
+    LOGFILE=`expr "${ACTION}" : 'log=[  ]*\(.*\)'`
+    ACTION=logit
+    ;;
+doit=*)
+    LOGFILE=`expr "${ACTION}" : 'doit=[         ]*\(.*\)'`
+    ACTION=doit
+    ;;
+esac
+
+case "${LOGFILE}" in
+"")
+    LOGFILE=/dev/null
+    ;;
+mail|/*)
+    ;;
+*)
+    LOGFILE=${MOST_LOGS}/${LOGFILE}.log
+    ;;
+esac
+export LOGFILE
diff --git a/usr/src/contrib/news/inn/samples/rc.news b/usr/src/contrib/news/inn/samples/rc.news
new file mode 100644 (file)
index 0000000..864ac5f
--- /dev/null
@@ -0,0 +1,79 @@
+#! /bin/sh
+##  $Revision: 1.18 $
+##  News boot script.
+
+##  =()<. @<_PATH_SHELLVARS>@>()=
+. /var/spool/news/data/innshellvars
+
+##  Pick ${INND} or ${INNDSTART}
+WHAT=${INNDSTART}
+##  Set to true or false
+DOINNWATCH=false
+MAIL="${MAILCMD} -s 'Boot-time Usenet warning on `hostname`' ${NEWSMASTER}"
+
+##  RFLAG is set below; set FLAGS as appropriate.
+RFLAG=""
+FLAGS="-i0"
+
+##  Clean shutdown?
+if [ -f ${SERVERPID} ] ; then
+    ( echo 'INND:  PID file exists -- unclean shutdown!' >/dev/console )
+    RFLAG="-r"
+fi
+
+if [ ! -f ${NEWSLIB}/.news.daily ] ; then
+    echo 'No .news.daily file; need to run news.daily?' | eval ${MAIL}
+else
+    case `find ${NEWSLIB} -name .news.daily -mtime +1 -print 2>/dev/null` in
+    "")
+       ;;
+    *)
+       echo 'Old .news.daily file; need to run news.daily?' | eval ${MAIL}
+       ;;
+    esac
+fi
+
+##  Active file recovery.
+if [ ! -s ${ACTIVE} ] ; then
+    if [ -s ${NEWACTIVE} ] ; then
+       mv ${NEWACTIVE} ${ACTIVE}
+    else
+       if [ -s ${OLDACTIVE} ] ; then
+           cp ${OLDACTIVE} ${ACTIVE}
+       else
+           ( echo 'INND:   No active file!' >/dev/console )
+           exit 1
+       fi
+    fi
+    RFLAG="-r"
+    # You might want to rebuild the DBZ database, too:
+    #echo "cd ${NEWSLIB} \
+    #          && makehistory -r \
+    #          && mv history.n.dir history.dir \
+    #          && mv history.n.pag history.pag" | su ${NEWSUSER}
+fi
+
+##  Remove temporary batchfiles and lock files.
+( cd ${BATCH} && rm -f bch* )
+( cd ${LOCKS} && rm -f LOCK* )
+( cd ${TEMPSOCKDIR} && rm -f ${TEMPSOCK} )
+rm -f ${NEWSCONTROL} ${NNTPCONNECT} ${SERVERPID}
+
+##  Start the show.
+( echo 'Starting innd.' >/dev/console )
+eval ${WHAT} ${RFLAG} ${FLAGS}
+
+# Gee, looks like lisp, doesn't it?
+${DOINNWATCH} && {
+    echo "( ( sleep 60 ; ${INNWATCH} ) & )" | su ${NEWSUSER}
+}
+
+RMFILE=${MOST_LOGS}/expire.rm
+if [ -s ${MOST_LOGS}/expire.rm ] ; then
+    ( echo "Removing articles from pre-downtime expire run." >/dev/console )
+    (
+       echo 'System shut down during expire.  Unlinking articles listed in'
+       echo ${RMFILE}
+    ) | eval ${MAIL}
+    echo "${NEWSBIN}/expirerm ${RMFILE}" | su ${NEWSUSER} &
+fi
diff --git a/usr/src/contrib/news/inn/samples/rmgroup b/usr/src/contrib/news/inn/samples/rmgroup
new file mode 100644 (file)
index 0000000..04562a7
--- /dev/null
@@ -0,0 +1,75 @@
+#! /bin/sh
+##  $Revision: 1.16 $
+##  Rmgroup control-message handler
+
+PROG=rmgroup
+##  Some shells don't pass in $* unless we explicitly pass it in here.
+##  =()<. @<_PATH_PARSECTL>@ "$@">()=
+. /var/spool/news/data/parsecontrol "$@"
+
+case ${ACTION} in
+mail)
+    grep "^$1 " ${ACTIVE} >/dev/null 2>&1 || {
+       # Group doesn't exist
+       exit
+    }
+    P1=$1
+    export FROM P1 NEWSBIN ARTICLE
+    (
+       echo "${FROM} requested that ${P1} be removed."
+       echo 'To do this, type the following:'
+       echo "  ${NEWSBIN}/ctlinnd rmgroup ${P1}"
+       echo ''
+       echo 'The full article was:'
+       cat ${ARTICLE}
+    ) | ${MAILCMD} -s "rmgroup $1 by ${FROM}" ${NEWSMASTER}
+    exit
+    ;;
+esac
+
+##  Make sure the article is approved and that the group exists.
+${SED} -e '/^$/q' <$ARTICLE >${TEMP}
+grep '^Approved:' <${TEMP} >/dev/null 2>&1 || {
+    ${WRITELOG} ${LOGFILE} "Unapproved rmgroup by ${FROM}" <${ARTICLE}
+    rm -f ${TEMP}
+    exit
+}
+rm -f ${TEMP}
+grep "^$1 " ${ACTIVE} >/dev/null 2>&1 || {
+    # Group doesn't exist
+    exit
+}
+
+case ${ACTION} in
+logit)
+    ${WRITELOG} ${LOGFILE} "rmgroup $1 by ${FROM} skipped" <${ARTICLE}
+    exit
+    ;;
+esac
+
+##  Do the work.
+ctlinnd -s rmgroup "$1"
+${WRITELOG} ${LOGFILE} "rmgroup $1 by ${FROM}" <${ARTICLE}
+
+##  We're sending to a file.
+LOCK=${LOCKS}/LOCK.newsgroups
+PID=$$
+TRY=0
+MAXTRY=60
+export LOCK MAXTRY PID LOGFILE TRY
+while [ ${TRY} -lt ${MAXTRY} ]; do
+    shlock -p ${PID} -f ${LOCK} && break
+    sleep 2
+    TRY=`expr ${TRY} + 1`
+done
+
+##  If we got the lock, update the file; otherwise, give up.
+test ${TRY} -lt ${MAXTRY} || {
+    echo "Newgroup cannot update newsgroups.  Locked by" `cat ${LOCK}` 1>&2
+    exit
+}
+
+${EGREP} -v "^$1[      ]" <${NEWSGROUPS} >${TEMP}
+cat ${TEMP} >${NEWSGROUPS}
+rm ${TEMP} ${LOCK}
+exit
diff --git a/usr/src/contrib/news/inn/samples/scanlogs b/usr/src/contrib/news/inn/samples/scanlogs
new file mode 100644 (file)
index 0000000..9678fe6
--- /dev/null
@@ -0,0 +1,351 @@
+#! /bin/sh
+##  $Revision: 1.21 $
+##  Summarize INN log files.
+##  Optional arguments:
+##     norotate        Do not rotate logfiles
+
+##  =()<. @<_PATH_SHELLVARS>@>()=
+. /var/spool/news/data/innshellvars
+
+##  If you get an error from this line:
+##     sh -c 'egrep "`ls /etc`" /dev/null'
+##  then get a better egrep, like the FSF one.
+
+##  Directory where old log files are kept.
+OLD=${MOST_LOGS}/OLD
+##  If you want to archive the active file, enable this line.
+ACTIVEFILE=${ACTIVE}
+##  Number of lines of error in each category to report.
+TOP=${TOP-20}
+##  NN log file.
+NN=${NEWSLIB}/nn/Log
+##  Where nntpsend, if used, writes its log information.
+NNTPSEND=${MOST_LOGS}/nntpsend.log
+##  Where news.daily places expire output, unless noexplog was used.
+EXPLOG=${MOST_LOGS}/expire.log
+
+##  If you divide your news syslog into separate files, list them here.
+SYSLOG_CRIT=${MOST_LOGS}/news.crit
+SYSLOG_ERR=${MOST_LOGS}/news.err
+SYSLOG_NOTICE=${MOST_LOGS}/news.notice
+SYSLOGS="${SYSLOG_CRIT} ${SYSLOG_ERR} ${SYSLOG_NOTICE}"
+
+##  Where tally control and unwanted processors are found.
+TALLY_CONTROL=${NEWSBIN}/tally.control
+TALLY_UNWANTED=${NEWSBIN}/tally.unwanted
+UNWANTED_LOG=${MOST_LOGS}/unwanted.log
+CONTROL_LOG=${MOST_LOGS}/control.log
+CONTROL_DATA=
+test -f ${MOST_LOGS}/newgroup.log && CONTROL_DATA=${MOST_LOGS}/newgroup.log
+test -f ${MOST_LOGS}/rmgroup.log \
+       && CONTROL_DATA="${CONTROL_DATA} ${MOST_LOGS}/rmgroup.log"
+
+##  Build up the list of log files to process.
+LOGS="${ERRLOG} ${EXPLOG} ${LOG} ${ACTIVEFILE} ${SYSLOGS} ${UNWANTED_LOG}"
+test -n "${NNTPSEND}" -a -f "${NNTPSEND}" && LOGS="${LOGS} ${NNTPSEND}"
+test -n "${CONTROL_DATA}" && LOGS="${LOGS} ${CONTROL_LOG}"
+for F in checkgroups default ihave newgroup rmgroup sendme \
+        sendsys senduuname version miscctl; do
+    test -f ${MOST_LOGS}/${F}.log && LOGS="${LOGS} ${MOST_LOGS}/${F}.log"
+done
+
+PROGNAME=scanlogs
+LOCK=${LOCKS}/LOCK.${PROGNAME}
+
+##  Set defaults.
+ROTATE=true
+
+##  Parse JCL.
+for I
+do
+    case "X$I" in
+    Xnonn)
+       # Ignore this.
+       ;;
+    Xnorotate)
+       ROTATE=false
+       ;;
+    *)
+       echo "Unknown flag ${I}" 1>&2
+       exit 1
+       ;;
+    esac
+done
+
+##  Make sure every log exists.
+for F in ${LOGS} ; do
+    test ! -f ${F} && touch ${F}
+done
+
+##  Temporary files.
+T=${TMPDIR}/scan$$
+PROBS=${TMPDIR}/scanlog$$
+trap "rm -f ${T} ${PROBS}; exit 0" 0 1 2 3 15
+
+##  Rotate the logs?
+if ${ROTATE} ; then
+    ##  Lock out others.
+    shlock -p $$ -f ${LOCK} || {
+       echo "$0: Locked by `cat ${LOCK}`"
+       exit 1
+    }
+    trap "rm -f ${T} ${PROBS} ${LOCK}; exit 0" 1 2 3 15
+
+    HERE=`pwd`
+    cd ${MOST_LOGS}
+
+    ctlinnd -s pause "Flushing log and syslog files" 2>&1
+    ctlinnd -s flushlogs 2>&1 || {
+       echo 'Cannot flush logs.'
+       rm -f ${LOCK}
+       exit 1
+    }
+
+    ##  Make sure these .old files exist, in case innd is down.
+    for F in ${LOG} ${ERRLOG} ${EXPLOG} ; do
+       if [ ! -f ${F}.old ]; then
+           rm -f ${F}.old
+           cp ${F} ${F}.old
+           cat /dev/null >${F}
+       fi
+    done
+
+    ##  Copy syslog files, truncating old inode since syslog has it open.
+    for F in ${SYSLOGS}; do
+       rm -f ${F}.old
+       cp ${F} ${F}.old
+       cat /dev/null >${F}
+    done
+
+    ##  Make a copy of the active file.
+    if [ -n ${ACTIVEFILE} ] ; then
+       BASE=`basename ${ACTIVEFILE}`
+       rm -f ${OLD}/${BASE}.old
+       cp ${ACTIVEFILE} ${OLD}/${BASE}.old
+    fi
+
+    ##  These are live files, so use link rather than copy.
+    for F in ${NNTPSEND} ; do
+       if [ -f ${F} ]; then
+           rm -f ${F}.old ${F}.new
+           ln ${F} ${F}.old
+           touch ${F}.new
+           chmod 0660 ${F}.new
+           mv ${F}.new ${F}
+       fi
+    done
+
+    ##  Tally control messages if we logged them.
+    test -n "${CONTROL_DATA}" && cat ${CONTROL_DATA} | ${TALLY_CONTROL}
+    ${TALLY_UNWANTED} <${LOG}.old
+
+    ctlinnd -s go "Flushing log and syslog files" 2>&1
+
+    cd ${OLD}
+    for F in ${LOGS}; do
+       ##  Process the current (just-flushed) log
+       BASE=`basename ${F}`
+       rm -f ${OLD}/${BASE}
+       case ${F} in
+       ${SYSLOG_CRIT}|${ERRLOG}|${EXPLOG}|${LOG}|${SYSLOG_NOTICE})
+           ##  Make a link that can be deleted (since if not rotating
+           ##  we delete the copy that is made in ${TMPDIR}).
+           mv ${F}.old ${OLD}/${BASE}
+           rm -f ${OLD}/${BASE}.0
+           ln ${OLD}/${BASE} ${OLD}/${BASE}.0
+           ;;
+       ${ACTIVEFILE})
+           mv ${BASE}.old ${OLD}/${BASE}
+           ;;
+       ${SYSLOG_ERR})
+           mv ${F}.old ${OLD}/${BASE}
+           ;;
+       *)
+           if [ -f ${F}.old ]; then
+               mv ${F}.old ${OLD}/${BASE}
+           else
+               rm -f ${OLD}/${BASE} ${F}.new
+               touch ${F}.new
+               chmod 0660 ${F}.new
+               ln ${F} ${OLD}/${BASE}
+               mv ${F}.new ${F}
+           fi
+           ;;
+       esac
+    done
+    cd ${HERE}
+
+    ##  Truncate logs from send-nntp and/or send-uucp.
+    if [ -s ${MOST_LOGS}/send-nntp.log ] ; then
+       ${COMPRESS} <${MOST_LOGS}/send-nntp.log >${OLD}/send-nntp.1${Z}
+       cat /dev/null >${MOST_LOGS}/send-nntp.log
+    fi
+    if [ -s ${MOST_LOGS}/send-uucp.log ] ; then
+       ${COMPRESS} <${MOST_LOGS}/send-uucp.log >${OLD}/send-uucp.1${Z}
+       cat /dev/null >${MOST_LOGS}/send-uucp.log
+    fi
+else
+    ##  Don't use the real OLD directory, instead use TMPDIR
+    OLD=${TMPDIR}
+
+    ##  Make a snapshot of what we need for below.
+    ctlinnd -s pause "Snapshot log and syslog files" 2>&1
+    for F in ${SYSLOG_CRIT} ${ERRLOG} ${EXPLOG} ${LOG} ${SYSLOG_NOTICE} ; do
+       BASE=`basename ${F}`
+       rm -f ${OLD}/${BASE}.0
+       cp ${F} ${OLD}/${BASE}.0
+    done
+    ctlinnd -s go "Snapshot log and syslog files" 2>&1
+fi
+
+##
+##  We now (finally!) have copies of the log files where we need them.
+##
+
+##  Display syslog critical messages.
+BASE=`basename ${SYSLOG_CRIT}`
+OLD_SYSLOG=${OLD}/${BASE}.0
+if [ -s ${OLD_SYSLOG} ] ; then
+    echo Syslog critical messages:
+    cat ${OLD_SYSLOG}
+    echo ---------
+    echo ''
+fi
+rm -f ${OLD_SYSLOG}
+
+##  Display error log.
+BASE=`basename ${ERRLOG}`
+OLD_ERRLOG=${OLD}/${BASE}.0
+if [ -s ${OLD_ERRLOG} ] ; then
+    echo Error log:
+    cat ${OLD_ERRLOG}
+    echo ---------
+    echo ''
+fi
+rm -f ${OLD_ERRLOG}
+
+##  Display expire log messages
+BASE=`basename ${EXPLOG}`
+OLD_EXPLOG=${OLD}/${BASE}.0
+if [ -s ${OLD_EXPLOG} ] ; then
+    echo Expire messages:
+    cat ${OLD_EXPLOG}
+    echo ---------
+    echo ''
+fi
+rm -f ${OLD_EXPLOG}
+
+##  Scan for various problems in articles we were offered or sent.
+BASE=`basename ${LOG}`
+OLD_LOG=${OLD}/${BASE}.0
+if [ -f ${OLD_LOG} ]; then
+    ${AWK} '$4 == "-" || $4 == "j" { print }' <${OLD_LOG} >${PROBS}
+
+    ${AWK} '$4 == "-" { print $5; }' ${PROBS} \
+           | sort | uniq -c | sort -nr | ${SED} ${TOP}q >${T}
+    if [ -s ${T} ] ; then
+       echo Top ${TOP} sites sending bad articles:
+       cat ${T}
+       echo ''
+    fi
+
+    ${AWK} '$4 == "j" { print $5; }' ${PROBS} \
+           | sort | uniq -c | sort -nr | ${SED} ${TOP}q >${T}
+    if [ -s ${T} ] ; then
+       echo Top ${TOP} sites sending junked "(unwanted)" articles:
+       cat ${T}
+       echo ''
+    fi
+
+
+    ${EGREP} '437 Unwanted distribution' ${PROBS} | ${SED} 's/.*"\(.*\)".*/\1/' \
+           | sort | uniq -c | sort -nr | ${SED} ${TOP}q >${T}
+    if [ -s ${T} ] ; then
+       echo Top ${TOP} unwanted distributions by number of articles:
+       cat ${T}
+       echo ''
+    fi
+
+    ${EGREP} '437 Unapproved for' ${PROBS} | ${SED} 's/.*"\(.*\)".*/\1/' \
+           | sort | uniq -c | sort -nr | ${SED} ${TOP}q >${T}
+    if [ -s ${T} ] ; then
+       echo Top ${TOP} supposedly-moderated groups with unmoderated postings:
+       cat ${T}
+       echo ''
+    fi
+
+    ${EGREP} '437 Unwanted newsgroup' ${PROBS} | ${SED} 's/.*"\(.*\)".*/\1/' \
+           | sort | uniq -c | sort -nr | ${SED} ${TOP}q >${T}
+    if [ -s ${T} ] ; then
+       echo Top ${TOP} unwanted newsgroups:
+       cat ${T}
+       echo ''
+    fi
+
+    ##  Your egrep may complain about this regular expression being too long;
+    ##  if so, complain to your vendor and try GNU egrep.
+    P1='No body|EOF in headers|"Message-ID"|No colon-space in '
+    P2='Missing ".*" header|Linecount|Bad Date|Too old'
+    ${EGREP} "${P1}|${P2}" ${PROBS} \
+           | ${SED} -e 's/.*437 //' \
+               -e 's/Linecount.*/Linecount wrong/' -e 's/Too old.*/Too old/' \
+           | sort | uniq -c | sort -nr | ${SED} ${TOP}q >${T}
+    if [ -s ${T} ] ; then
+       echo Top ${TOP} general message problems:
+       cat ${T}
+       echo ''
+    fi
+
+    ${EGREP} "${P1}|${P2}" ${PROBS} | ${AWK} '{print $5}' \
+           | sort | uniq -c | sort -nr | ${SED} ${TOP}q >${T}
+    if [ -s ${T} ] ; then
+       echo Top ${TOP} sites sending news with bad headers:
+       cat ${T}
+       echo ''
+    fi
+    rm -f ${PROBS}
+fi
+rm -f ${OLD_LOG}
+
+##  Summarize syslog information
+BASE=`basename ${SYSLOG_NOTICE}`
+OLD_SYSLOG=${OLD}/${BASE}.0
+if [ -s ${OLD_SYSLOG} ] ; then
+    echo Syslog summary:
+    ##  Portable work-around some debugging syslogs.
+    ${SED} -e 's/{news.[a-z]*} //' <${OLD_SYSLOG} | ${AWK} -f ${NEWSLIB}/innlog.awk
+    echo ---------
+    echo ''
+fi
+rm -f ${OLD_SYSLOG}
+
+##  Compress and rotate the logs.
+if ${ROTATE} ; then
+    cd ${OLD}
+    for F in ${LOGS} ; do
+       ##  Skip if file doesn't exist.
+       BASE=`basename ${F}`
+       test -f ${BASE} || continue
+
+       ##  Compress the file.
+       ${COMPRESS} <${BASE} >${BASE}.0${Z} && rm -f ${BASE}
+       chmod 0440 ${BASE}.0${Z}
+
+       ##  Do rotation.
+       EXT=${CYCLES}
+       rm -f ${BASE}.${CYCLES}${Z}
+       while [ ${EXT} -gt 0 ] ; do
+           NEXT=${EXT}
+           EXT=`expr ${EXT} - 1`
+           test -f ${BASE}.${EXT}${Z} \
+               && rm -f ${BASE}.${NEXT}${Z} \
+               && mv ${BASE}.${EXT}${Z} ${BASE}.${NEXT}${Z}
+       done
+    done
+
+    ##  Remove lock.
+    rm -f ${LOCK}
+fi
+
+##  All done.
+exit 0
diff --git a/usr/src/contrib/news/inn/samples/send-ihave b/usr/src/contrib/news/inn/samples/send-ihave
new file mode 100644 (file)
index 0000000..c12786b
--- /dev/null
@@ -0,0 +1,62 @@
+#! /bin/sh
+##  $Revision: 1.6 $
+##  SH script to send IHAVE batches out.
+
+##  =()<. @<_PATH_SHELLVARS>@>()=
+. /var/spool/news/data/innshellvars
+
+PROGNAME=`basename $0`
+LOCK=${LOCKS}/LOCK.${PROGNAME}
+LOG=${MOST_LOGS}/${PROGNAME}.log
+
+## How many Message-ID's per message.
+PERMESSAGE=1000
+
+##  Start logging.
+test ! -f ${LOG} && touch ${LOG}
+chmod 0660 ${LOG}
+exec >>${LOG} 2>&1
+echo "${PROGNAME}: [$$] begin `date`"
+cd ${BATCH}
+
+##  Anyone else there?
+trap 'rm -f ${LOCK} ; exit 1' 1 2 3 15
+shlock -p $$ -f ${LOCK} || {
+    echo "${PROGNAME}: [$$] locked by [`cat ${LOCK}`]"
+    exit 0
+}
+
+##  Do the work.
+for SITE in $* ; do
+
+    ##  See if any data is ready for host.
+    BATCHFILE=${SITE}.ihave.batch
+    if [ -f ${SITE}.iwork ] ; then
+       cat ${SITE}.iwork >>${BATCHFILE}
+       rm -f ${SITE}.iwork
+    fi
+    mv ${SITE}.ihave ${SITE}.iwork
+    ctlinnd -s -t30 flush ${SITE}.ihave || continue
+    cat ${SITE}.iwork >>${BATCHFILE}
+    rm -f ${SITE}.iwork
+    echo "${PROGNAME}: [$$] begin ${SITE}"
+
+    ##  Write out the batchfile as a control message, in clumps.
+    export SITE PERMESSAGE BATCHFILE
+    while test -s ${BATCHFILE} ; do
+       (
+           echo Newsgroups: to.${SITE}
+           echo Control: ihave `innconfval pathhost`
+           echo ''
+           ${SED} -e ${PERMESSAGE}q <${BATCHFILE}
+       ) | ${INEWS} -h
+       ${SED} -e "1,${PERMESSAGE}d" <${BATCHFILE} >${BATCHFILE}.tmp
+       mv ${BATCHFILE}.tmp ${BATCHFILE}
+    done
+    echo "${PROGNAME}: [$$] end ${SITE}"
+done
+
+##  Remove the lock file.
+rm -f ${LOCK}
+
+exit
diff --git a/usr/src/contrib/news/inn/samples/send-nntp b/usr/src/contrib/news/inn/samples/send-nntp
new file mode 100644 (file)
index 0000000..d366b48
--- /dev/null
@@ -0,0 +1,76 @@
+#! /bin/sh
+##  $Revision: 1.16 $
+##  SH script to send NNTP news out.
+
+##  =()<. @<_PATH_SHELLVARS>@>()=
+. /var/spool/news/data/innshellvars
+
+PROGNAME=`basename $0`
+LOG=${MOST_LOGS}/${PROGNAME}.log
+
+##  Go to where the action is, start logging
+cd $BATCH
+umask 002
+DEBUG=""
+if [ "X$1" = X-d ] ; then
+    DEBUG="-d"
+    shift
+else
+    test ! -f ${LOG} && touch ${LOG}
+    chmod 0660 ${LOG}
+    exec >>${LOG} 2>&1
+fi
+
+echo "${PROGNAME}: [$$] begin `date`"
+
+##  List of sitename:hostname pairs to send to
+if [ -n "$1" ] ; then
+    LIST="$*"
+else
+    LIST="site:site.their.domain"
+    LIST="${LIST} site2:foo.bar.com"
+fi
+
+for L in ${LIST} ; do
+    case $L in
+    *:*)
+       SITE=`expr $L : '\(.*\):.*'`
+       HOST=`expr $L : '.*:\(.*\)'`
+       ;;
+    *)
+       SITE=$L
+       HOST=$L
+       ;;
+    esac
+    LOCK=NNTP_LOCK.${HOST}
+    BATCHFILE=${HOST}.nntp
+    LOCK=${LOCKS}/LOCK.${L}
+    trap 'rm -f ${LOCK} ; exit 1' 1 2 3 15
+    shlock -p $$ -f ${LOCK} || {
+       echo "${PROGNAME}: [$$] ${HOST} locked by `cat ${LOCK}`"
+       continue
+    }
+    if [ -f ${SITE}.work ] ; then
+       cat ${SITE}.work >>${BATCHFILE}
+       rm -f ${SITE}.work
+    fi
+    if [ ! -f ${SITE} -o ! -s ${SITE} ] ; then
+       if [ ! -f ${BATCHFILE} -o ! -s ${BATCHFILE} ] ; then
+           rm -f ${LOCK}
+           continue
+       fi
+    fi
+    mv ${SITE} ${SITE}.work
+    if ctlinnd -s -t30 flush ${SITE} ; then
+       cat ${SITE}.work >>${BATCHFILE}
+       rm -f ${SITE}.work
+       if [ -s ${BATCHFILE} ] ; then
+           echo "${PROGNAME}: [$$] begin ${HOST}"
+           time innxmit ${DEBUG} ${HOST} ${BATCH}/${BATCHFILE}
+           echo "${PROGNAME}: [$$] end   ${HOST}"
+       fi
+    fi
+    rm -f ${LOCK}
+done
+
+echo "${PROGNAME}: [$$] end   `date`"
diff --git a/usr/src/contrib/news/inn/samples/send-uucp b/usr/src/contrib/news/inn/samples/send-uucp
new file mode 100644 (file)
index 0000000..cf94b12
--- /dev/null
@@ -0,0 +1,116 @@
+#! /bin/sh
+##  $Revision: 1.11 $
+##  SH script to send UUCP batches out.
+
+##  =()<. @<_PATH_SHELLVARS>@>()=
+. /var/spool/news/data/innshellvars
+
+PROGNAME=`basename $0`
+LOCK=${LOCKS}/LOCK.${PROGNAME}
+LOG=${MOST_LOGS}/${PROGNAME}.log
+
+MAXJOBS=200
+UUXFLAGS="- -r -gd"
+
+##  Start logging.
+test ! -f ${LOG} && touch ${LOG}
+chmod 0660 ${LOG}
+exec >>${LOG} 2>&1
+echo "${PROGNAME}: [$$] begin `date`"
+cd ${BATCH}
+
+##  Anyone else there?
+trap 'rm -f ${LOCK} ; exit 1' 1 2 3 15
+shlock -p $$ -f ${LOCK} || {
+    echo "${PROGNAME}: [$$] locked by [`cat ${LOCK}`]"
+    exit 0
+}
+
+##  Who are we sending to?
+if [ -n "$1" ] ; then
+    LIST="$*"
+else
+    LIST=""
+    case `date +%H` in
+    01|04|07|21|23)
+       LIST="kurz-ai aoa clsib21 leafusa metasoft"
+       ;;
+    06|12|15|17|20)
+       LIST="esca"
+       ;;
+    esac
+fi
+
+case ${HAVE_UUSTAT} in
+DONT)
+    TEMP=${TMPDIR}/uuq$$
+    uuq -h |tr -d : >${TEMP}
+    ;;
+esac
+
+##  Do the work...
+for SITE in ${LIST}; do
+
+    ##  See if any data is ready for host.
+    BATCHFILE=${SITE}.uucp
+    if [ -f ${SITE}.work ] ; then
+       cat ${SITE}.work >>${BATCHFILE}
+       rm -f ${SITE}.work
+    fi
+    mv ${SITE} ${SITE}.work
+    ctlinnd -s -t30 flush ${SITE} || continue
+    cat ${SITE}.work >>${BATCHFILE}
+    rm -f ${SITE}.work
+    if [ ! -s ${BATCHFILE} ] ; then
+       echo "${PROGNAME}: [$$] no articles for ${SITE}"
+       rm -f ${BATCHFILE}
+       continue
+    fi
+
+    ##  Get number of jobs for the current site.
+    case ${HAVE_UUSTAT} in
+    DONT)
+       JOBS=`${AWK} \
+           'BEGIN{X=0}  {if ($1 == "'$SITE'") X=$2}  END{print X}' <${TEMP}`
+       ;;
+    DO)
+       JOBS=`uustat -s${SITE} | grep rnews | wc -l`
+       ;;
+    *)
+       JOBS=0
+       ;;
+    esac
+    if [ ${JOBS} -ge ${MAXJOBS} ] ; then
+       echo "${PROGNAME}: [$$] ${JOBS} files already queued for ${SITE}"
+       continue
+    fi
+    QUEUEJOBS=`expr ${MAXJOBS} - ${JOBS}`
+
+    ##  Get the compression flags.
+    echo "${PROGNAME}: [$$] begin ${SITE}"
+    case "${SITE}" in
+    esca)
+       COMPRESS="compress -b12"
+       ;;
+    *)
+       COMPRESS="compress"
+       ;;
+    esac
+
+    time batcher -N ${QUEUEJOBS} \
+       -p"(echo '#! cunbatch' ; exec ${COMPRESS} ) | uux ${UUXFLAGS} %s!rnews" \
+       ${SITE} ${BATCHFILE}
+
+    echo "${PROGNAME}: [$$] end ${SITE}"
+done
+
+case ${HAVE_UUSTAT} in
+DONT)
+    rm -f ${TEMP}
+    ;;
+esac
+
+##  Remove the lock file.
+rm -f ${LOCK}
+
+echo "${PROGNAME}: [$$] end `date`"
diff --git a/usr/src/contrib/news/inn/samples/sendbatch b/usr/src/contrib/news/inn/samples/sendbatch
new file mode 100644 (file)
index 0000000..6c85b49
--- /dev/null
@@ -0,0 +1,210 @@
+#! /bin/sh
+##  $Revision: 1.10 $
+##  SH script to send UUCP batches out.  By Mike Cooper and Rich $alz.
+##  Based on B News sendbatch 1.22 10/29/89.
+
+##  =()<. @<_PATH_SHELLVARS>@>()=
+. /var/spool/news/data/innshellvars
+
+##  Place to run a df, and amount of space needed.
+UUSPOOL=/usr/spool/uucp
+SPOOLFREE=20000
+##  Program names and flags.  Most can be set on the command-line.
+C7=
+COMP=
+COMPFLAGS=
+COMPRESS=/usr/ucb/compress
+ECHO=
+##  Not a config param since this is the remote rnews.
+RNEWS=rnews
+UUX=uux
+UUXFLAGS="- -r -n -gd"
+##  Desired size of each batch, total number of bytes we want to queue.
+DEFBYTES=50000
+BYTESQUEUED=1000000000
+
+PROG=`basename $0`
+LOCK=${LOCKS}/LOCK.${PROGNAME}
+
+##  Go to where the action is.
+cd ${BATCH}
+
+
+##  Loop over command line.
+for SITE
+do
+    ##  Is this a flag?
+    case "${SITE}" in
+    -s*)
+       DEFBYTES=`expr "${SITE}" : '-s\(.*\)'`
+       continue
+       ;;
+    -m*)
+       BYTESQUEUED=`expr "${SITE}" : '-m\(.*\)'`
+       continue
+       ;;
+    +m)
+       BYTESQUEUED=''
+       continue
+       ;;
+    -p*)
+       BYTESPERRUN=`expr "${SITE}" : '-p\(.*\)'`
+       continue
+       ;;
+    +p)
+       BYTESPERRUN=''
+       continue
+       ;;
+    -r*)
+       RNEWS=`expr "${SITE}" : '-r\(.*\)'`
+       continue
+       ;;
+    -U*)
+       UUX=`expr "${SITE}" : '-U\(.*\)'`
+       continue
+       ;;
+    -u*)
+       UUXFLAGS=`expr "${SITE}" : '-u\(.*\)'`
+       continue
+       ;;
+    -c7)
+       COMP="; exec ${COMPRESS} ${COMPFLAGS} | $LIB/encode"
+       ECHO="echo '#! c7unbatch'"
+       continue
+       ;;
+    -c)
+       COMP="; exec ${COMPRESS} ${COMPFLAGS}"
+       ECHO="echo '#! cunbatch'"
+       continue
+       ;;
+    +c)
+       COMP=''
+       C7=''
+       ECHO=''
+       COMPFLAGS=''
+       continue
+       ;;
+    -[bBC]*)
+       COMPFLAGS="${COMPFLAGS} ${SITE}"
+       continue
+       ;;
+    -o*)
+       ECHO=`expr "${SITE}" : '-o\(.*\)'`
+       RNEWS='cunbatch'
+       continue
+       ;;
+    +o)
+       ECHO=''
+       RNEWS=rnews
+       continue
+       ;;
+    -D*)
+       UUSPOOL=`expr "${SITE}" : '-D\(.*\)'`
+       continue
+       ;;
+    +D)
+       UUSPOOL=''
+       continue
+       ;;
+    -f*)
+       SPOOLFREE=`expr "${SITE}" : '-f\(.*\)'`
+       continue
+       ;;
+    esac
+    test -z "${BYTESPERRUN}" && BYTESPERRUN=${BYTESQUEUED}
+
+    ##  We have a site; lock it.
+    LOCK=${LOCKS}/LOCK.${SITE}
+    trap 'rm -f ${LOCK} ; exit 1' 1 2 3 15
+    shlock -p $$ -f ${LOCK} || {
+       echo "${PROG}:  ${SITE} Locked by `cat ${LOCK}`."
+       continue
+    }
+
+    ##  Flush the batchfile.
+    BATCHFILE=${BATCH}/${SITE}.uucp
+    if [ -f ${SITE}.work ] ; then
+       cat ${SITE}.work >>${BATCHFILE}
+       rm -f ${SITE}.work
+    fi
+    mv ${SITE} ${SITE}.work
+    ctlinnd -s -t30 flush ${SITE} || {
+       echo "${PROG}:  Can't flush ${SITE}."
+       rm -f ${LOCK}
+       continue
+    }
+    cat ${SITE}.work >>${BATCHFILE}
+    rm -f ${SITE}.work
+    if [ ! -s ${BATCHFILE} ] ; then
+       echo "${PROG}:  No articles for ${SITE}."
+       rm -f ${LOCK}
+       continue
+    fi
+
+    ##  Check free space on the partition?
+    if [ -n "${UUSPOOL}" ] ; then
+       FREE=`(cd ${UUSPOOL}; df . | ${AWK} '
+               $6 == "'${UUSPOOL}'" { print $4 ; exit }
+               $1 == "'${UUSPOOL}'" && NF == 7 { print $4 ; exit }
+               $2 == "'${UUSPOOL}'" { print $5 ; exit }
+               $1 == "'${UUSPOOL}'" { print $3 ; exit }
+           ')`
+       if [ -n "${FREE}" -a "${FREE}" -lt ${SPOOLFREE} ] ; then
+           echo "${PROG}:  No space on ${UUSPOOL} for ${SITE} (${FREE})."
+           rm -f ${LOCK}
+           continue
+       fi
+    fi
+
+    ##  Check the host's queue size?
+    QUEUE=0
+    if [ -n "${BYTESQUEUED}" ] ; then
+       if [ -d /usr/spool/uucp/${SITE} ] ; then
+           # Get queue size from directory size
+           QUEUE=`du -s "/usr/spool/uucp/${SITE}" \
+                   | ${AWK} '{ printf("%s000\n", $1); }'`
+
+       else
+           ##  Get queue size from uuq command.
+           QUEUE=`uuq -l -s${SITE} | ${AWK} '{print $4; exit }'`
+       fi
+       test -z "${QUEUE}" && QUEUE=0
+       if [ "${QUEUE}" -gt ${BYTESQUEUED} ] ; then
+           echo "${PROG}:  ${SITE} has ${QUEUE} bytes queued."
+           rm -f ${LOCK}
+           continue
+       fi
+    fi
+
+    ##  Set how many bytes we can queue this time.
+    if [ -z "${BYTESQUEUED}" ] ; then
+       BATCHBYTES=${BYTESPERRUN}
+    else
+       BATCHBYTES=`expr ${BYTESQUEUED} - "${QUEUE}"`
+       test ${BATCHBYTES} -gt ${BYTESPERRUN} && BATCHBYTES=${BYTESPERRUN}
+    fi
+
+    # Say how big each batch should be.  Assume 50% compression.
+    if [ -n "${COMP}" ] ; then
+       MAXBYTES=`expr ${DEFBYTES} \* 2`
+    else
+       MAXBYTES=${DEFBYTES}
+    fi
+
+    ##  Assemble uux command to have batcher(1) run.
+    if [ -f ${SITE}.cmd ] ; then
+       UUXCOM="`cat ${SITE}.cmd`"
+    elif [ -n "${ECHO}" -o -n "${COMP}" ]; then
+       UUXCOM="( ${ECHO} ${COMP} ) | ${UUX} - ${UUXFLAGS} ${SITE}!${RNEWS}"
+    else
+       UUXCOM="${UUX} - ${UUXFLAGS} ${SITE}!${RNEWS}"
+    fi
+
+    ## Create batches.
+    if [ ${BATCHBYTES} -gt 0 ] ; then
+       ${NEWSBIN}/batcher -B ${BATCHBYTES} -b ${MAXBYTES} -p "${UUXCOM}" \
+           ${SITE} ${BATCHFILE}
+    fi
+
+    rm -f ${LOCK}
+done
diff --git a/usr/src/contrib/news/inn/samples/sendme b/usr/src/contrib/news/inn/samples/sendme
new file mode 100644 (file)
index 0000000..1d36635
--- /dev/null
@@ -0,0 +1,25 @@
+#! /bin/sh
+##  $Revision: 1.4 $
+##  Sendme control-message handler
+
+PROG=sendme
+##  Some shells don't pass in $* unless we explicitly pass it in here.
+##  =()<. @<_PATH_PARSECTL>@ "$@">()=
+. /var/spool/news/data/parsecontrol "$@"
+
+case ${ACTION} in
+mail)
+    ${MAILCMD} -s "sendme by ${FROM}" ${NEWSMASTER} <${ARTICLE}
+    ;;
+doit)
+    ##  Scan the message body.
+    ${SED} -e '1,/^$/d' <${ARTICLE} | grephistory -s >${TEMP}
+    if [ -s ${TEMP} ]; then
+       ## xxx Need to lock the work file?
+       cat ${TEMP} >>${BATCH}/${PATHHOST}.work
+    fi
+    rm -f ${TEMP}
+    ;;
+esac
+
+exit
diff --git a/usr/src/contrib/news/inn/samples/sendsys b/usr/src/contrib/news/inn/samples/sendsys
new file mode 100644 (file)
index 0000000..4f0a171
--- /dev/null
@@ -0,0 +1,57 @@
+#! /bin/sh
+##  $Revision: 1.12 $
+##  Sendsys control-message handler
+
+PROG=sendsys
+##  Some shells don't pass in $* unless we explicitly pass it in here.
+##  =()<. @<_PATH_PARSECTL>@ "$@">()=
+. /var/spool/news/data/parsecontrol "$@"
+
+##  See if the poster should have given an argument.
+case "${ACTION}-$1" in
+doifarg-)
+    ACTION=mail
+    ;;
+doifarg-*)
+    ACTION=doit
+    ;;
+esac
+
+SUBJECT="Sendsys reply from `innconfval pathhost`"
+case ${ACTION} in
+mail)
+    export FROM MAILCMD SUBJECT ARTICLE
+    (
+       echo "${FROM} posted a sendsys requesting your newsfeeds file."
+       echo ''
+       echo 'To reply, do the following:'
+       echo "  ${MAILCMD} -s \"${SUBJECT}\" ${FROM} <${NEWSFEEDS}"
+       echo ''
+       echo 'The full article was:'
+       cat ${ARTICLE}
+    ) | ${MAILCMD} -s "sendsys by ${FROM}" ${NEWSMASTER}
+    ;;
+logit)
+    ${WRITELOG} ${LOGFILE} "sendsys by ${FROM}; reply skipped" <${ARTICLE}
+    ;;
+doit)
+    case "$1" in
+    "")
+       ${MAILCMD} -s "${SUBJECT}" ${REPLYTO} <${NEWSFEEDS}
+       ${MAILCMD} -s "sendsys by ${FROM}; reply sent" ${NEWSMASTER} <${ARTICLE}
+       ;;
+    *)
+       ${AWK} "/^$1"'[/:\\]/,/[^\\]$/' ${NEWSFEEDS} >${TEMP}
+       trap 'rm -f ${TEMP} ; exit' 1 2 3 15
+       if [ -s ${TEMP} ] ;  then
+           ${MAILCMD} -s "${SUBJECT} for $1" ${REPLYTO} <${TEMP}
+           ${MAILCMD} -s "sendsys $1 by ${FROM}; reply sent" \
+                   ${NEWSMASTER} <${ARTICLE}
+       fi
+       rm -f ${TEMP}
+       ;;
+    esac
+    ;;
+esac
+
+exit
diff --git a/usr/src/contrib/news/inn/samples/senduuname b/usr/src/contrib/news/inn/samples/senduuname
new file mode 100644 (file)
index 0000000..5195384
--- /dev/null
@@ -0,0 +1,31 @@
+#! /bin/sh
+##  $Revision: 1.4 $
+##  Senduuname control-message handler
+
+PROG=senduuname
+##  Some shells don't pass in $* unless we explicitly pass it in here.
+##  =()<. @<_PATH_PARSECTL>@ "$@">()=
+. /var/spool/news/data/parsecontrol "$@"
+
+SUBJECT="Senduuname reply from `innconfval pathhost`"
+case ${ACTION} in
+mail)
+    export FROM MAILCMD SUBJECT ARTICLE
+    (
+       echo "${FROM} posted a senduuname."
+       echo 'To reply, do the following:'
+       echo "  uuname | ${MAILCMD} -s \"${SUBJECT}\" ${FROM}"
+       echo 'The full article was:'
+       cat ${ARTICLE}
+    ) | ${MAILCMD} -s "senduuname by ${FROM}" ${NEWSMASTER}
+    ;;
+logit)
+    ${WRITELOG} ${LOGFILE} "senduuname by ${FROM}; reply skipped" <${ARTICLE}
+    ;;
+doit)
+    uuname | ${MAILCMD} -s "${SUBJECT}" ${REPLYTO}
+    ${WRITELOG} ${LOGFILE} "senduuname by ${FROM}; reply sent" <${ARTICLE}
+    ;;
+esac
+
+exit
diff --git a/usr/src/contrib/news/inn/samples/tally.control b/usr/src/contrib/news/inn/samples/tally.control
new file mode 100644 (file)
index 0000000..e12e126
--- /dev/null
@@ -0,0 +1,60 @@
+#!/bin/sh
+##  $Revision: 1.5 $
+##  Tally/update the newgroup/rmgroup control log.
+##  Merge in a log that contains newgroup/rmgroup control messages so that
+##  the "control.log" file is updated to contain the new counts of how
+##  often each group has been newgroup'd or rmgroup'd.  This is run by
+##  scanlogs, which prepares this from the control-message handlers if
+##  control.ctl specifies logging.
+
+##  =()<. @<_PATH_SHELLVARS>@>()=
+. /var/spool/news/data/innshellvars
+
+CONTROL=${MOST_LOGS}/control.log
+CONTROL_NEW=${CONTROL}.new
+CONTROL_OLD=${CONTROL}.old
+
+PROGNAME=`basename $0`
+LOCK=${LOCKS}/LOCK.${PROGNAME}
+
+##  Lock.
+trap 'rm -f ${LOCK} ; exit 1' 1 2 3 15
+shlock -f ${LOCK} -p $$ || {
+    echo "$0: cannot lock ${LOCK}" 1>&2
+    exit 1
+}
+
+##  Prepare the files.
+if [ ! -f ${CONTROL} ]; then
+    touch ${CONTROL}
+    chmod 0660 ${CONTROL}
+fi
+rm -f ${CONTROL_NEW} ${CONTROL_OLD}
+ln ${CONTROL} ${CONTROL_OLD}
+touch ${CONTROL_NEW}
+chmod 0660 ${CONTROL_NEW}
+
+##  Grab the data.
+${SED} -n -e 's/[       ][      ]*/ /g' -e 's/^ \(Control:.*\)$/1 \1/p' \
+    | cat - ${CONTROL} \
+    | ${SED} -e 's/ /#/g' -e 's/\([0-9][0-9]*\)#\(.*\)/\1 \2/' \
+    | ${AWK} 'BEGIN {
+           ctl[0]=0;
+       }
+       {
+           ctl[$2] += $1;
+       }
+       END {
+           for (line in ctl) {
+               if (line != 0) {
+                   print ctl[line], line;
+               }
+           }
+       }' \
+    | tr '#' ' ' \
+    | sort -n -r >${CONTROL_NEW}
+mv -f ${CONTROL_NEW} ${CONTROL}
+
+##  All done.
+rm -f ${LOCK}
+exit 0
diff --git a/usr/src/contrib/news/inn/samples/tally.unwanted b/usr/src/contrib/news/inn/samples/tally.unwanted
new file mode 100644 (file)
index 0000000..cbd9278
--- /dev/null
@@ -0,0 +1,58 @@
+#!/bin/sh
+##  $Revision: 1.4 $
+##  Tally/update the unwanted newsgroup log
+##  Read an innd log on stdin, scan it for articles that were unwanted
+##  because they newsgroups were not in our active file.  Update unwanted.log
+##  to have the new count of unwanted groups, and how often they were used.
+
+##  =()<. @<_PATH_SHELLVARS>@>()=
+. /var/spool/news/data/innshellvars
+
+PROGNAME=unwanted
+LOCK=${LOCKS}/LOCK.${PROGNAME}
+LOG=${MOST_LOGS}/unwanted.log
+
+UNWANTED_NEW=${LOG}.new
+UNWANTED_OLD=${LOG}.old
+
+##  Lock.
+shlock -f ${LOCK} -p $$ || {
+    echo "$0: cannot lock $LOCK" 1>&2
+    exit 2
+}
+
+##  Prepare the files.
+if [ ! -f ${LOG} ]; then
+    touch ${LOG}
+    chmod 0660 ${LOG}
+fi
+rm -f ${UNWANTED_NEW} ${UNWANTED_OLD}
+ln ${LOG} ${UNWANTED_OLD}
+touch ${UNWANTED_NEW}
+chmod 0660 ${UNWANTED_NEW}
+
+##  Grab the data.
+${AWK} '$4 == "-" && $7 == "437" && $8 == "Unwanted" { print }' \
+    | ${SED} 's/.*"\(.*\)".*/\1/' \
+    | sort \
+    | uniq -c \
+    | cat - ${LOG} \
+    | ${AWK} 'BEGIN {
+           unwanted[0]=0;
+       }
+       {
+           unwanted[$2] += $1;
+       }
+       END {
+           for (group in unwanted) {
+               if (group != 0) {
+                   print unwanted[group], group;
+               }
+           }
+       }' \
+    | sort -n -r >${UNWANTED_NEW}
+mv -f ${UNWANTED_NEW} ${LOG}
+
+##  All done.
+rm -f ${LOCK}
+exit 0
diff --git a/usr/src/contrib/news/inn/samples/version b/usr/src/contrib/news/inn/samples/version
new file mode 100644 (file)
index 0000000..b3dbc7e
--- /dev/null
@@ -0,0 +1,35 @@
+#! /bin/sh
+##  $Revision: 1.23 $
+##  Version control-message handler
+
+PROG=version
+##  Some shells don't pass in $* unless we explicitly pass it in here.
+##  =()<. @<_PATH_PARSECTL>@ "$@">()=
+. /var/spool/news/data/parsecontrol "$@"
+
+VERSION="INN 1.4"
+
+WHERE=`innconfval pathhost`
+
+SUBJECT="Version reply from `innconfval pathhost`"
+case ${ACTION} in
+mail)
+    export FROM VERSION MAILCMD SUBJECT ARTICLE
+    (
+       echo "${FROM} requested your news version."
+       echo 'To reply, do the following:'
+       echo "  echo InterNetNews ${VERSION} | ${MAILCMD} -s \"${SUBJECT}\" ${FROM}"
+       echo 'The full article was:'
+       cat ${ARTICLE}
+    ) | ${MAILCMD} -s "version by ${FROM}" ${NEWSMASTER}
+    ;;
+logit)
+    ${WRITELOG} ${LOGFILE} "version by ${FROM}; reply skipped" <${ARTICLE}
+    ;;
+doit)
+    echo "InterNetNews ${VERSION}" | ${MAILCMD} -s "${SUBJECT}" ${REPLYTO}
+    ${WRITELOG} ${LOGFILE} "version by ${FROM}; reply sent" <${ARTICLE}
+    ;;
+esac
+
+exit
diff --git a/usr/src/contrib/news/inn/samples/writelog b/usr/src/contrib/news/inn/samples/writelog
new file mode 100644 (file)
index 0000000..1427f9e
--- /dev/null
@@ -0,0 +1,57 @@
+#! /bin/sh
+##  $Revision: 1.3 $
+##  Write a log file entry, by either mailing it or writing it safely.
+##  Usage:
+##     writelog name text... <input
+##  where
+##     name    is 'mail' to mail it, or filename to append to.
+
+##  =()<. @<_PATH_SHELLVARS>@>()=
+. /var/spool/news/data/innshellvars
+
+MAXTRY=60
+
+##  Parse arguments.
+if [ $# -lt 2 ] ; then
+    echo "usage: $0 'logfile|mail' message ..." 1>&2
+    exit 1
+fi
+LOGFILE="$1"
+shift
+MESSAGE="$@"
+
+##  Handle the easy cases.
+case "X${LOGFILE}" in
+X/dev/null)
+    exit 0
+    ;;
+Xmail)
+    ${MAILCMD} -s "${MESSAGE}" ${NEWSMASTER}
+    exit 0
+    ;;
+esac
+
+##  We're sending to a file.
+LOCK=${LOCKS}/LOCK.`basename ${LOGFILE}`
+
+##  Remember our PID, in case while is a sub-shell.
+PID=$$
+TRY=0
+
+export LOCK MAXTRY PID LOGFILE ARTICLE MESSAGE TRY
+while [ ${TRY} -lt ${MAXTRY} ]; do
+    shlock -p ${PID} -f ${LOCK} && break
+    sleep 2
+    TRY=`expr ${TRY} + 1`
+done
+
+##  If we got the lock, update the file; otherwise, give up.
+if [ ${TRY} -lt ${MAXTRY} ]; then
+    echo "${MESSAGE}" >>${LOGFILE}
+    ${SED} -e 's/^/    /' >>${LOGFILE}
+    echo "" >>${LOGFILE}
+    rm -f ${LOCK}
+else
+    ##  This goes to errlog, usually.
+    echo "$0: Cannot grab lock ${LOCK}, held by:" `cat ${LOCK}` 1>&2
+fi
diff --git a/usr/src/contrib/news/inn/syslog/syslog.conf b/usr/src/contrib/news/inn/syslog/syslog.conf
new file mode 100644 (file)
index 0000000..ff3f2cc
--- /dev/null
@@ -0,0 +1,21 @@
+##  $Header: /usr/local/src/inn/syslog/RCS/syslog.conf,v 1.5 1993/03/18 21:05:11 rsalz Exp $
+##  Sample syslog.conf file for folks not used to the new syslog.
+##
+
+##  This matches typical old-style config.  Log everything to a
+##  file and send warnings or worse to root.
+*.notice;news.err      /usr/spool/mqueue/syslog
+*.alert                        root
+
+##  Send critical messages to everyone who is logged in and to the console.
+news.crit              *
+news.crit              /dev/console
+
+##  Log news messages to separate files.
+##  Note that each level includes all of the above it.
+## =()<news.crit       @<_PATH_MOST_LOGS>@/news.crit>()=
+news.crit      /var/spool/news/data/news.crit
+## =()<news.err                @<_PATH_MOST_LOGS>@/news.err>()=
+news.err               /var/spool/news/data/news.err
+## =()<news.notice     @<_PATH_MOST_LOGS>@/news.notice>()=
+news.notice    /var/spool/news/data/news.notice