[comp.sources.misc] v17i021: rkive - Usenet sources archiver, Part05/06

kent@sparky.imd.sterling.com (Kent Landfield) (02/25/91)

Submitted-by: Kent Landfield <kent@sparky.imd.sterling.com>
Posting-number: Volume 17, Issue 21
Archive-name: rkive/part05

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then feed it
# into a shell via "sh file" or similar.  To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix@uunet.uu.net if you want that tool.
# If this archive is complete, you will see the following message at the end:
#		"End of archive 5 (of 6)."
# Contents:  rkive/Changes rkive/Makefile rkive/article.1
#   rkive/article.c rkive/article.h rkive/ckconfig.c rkive/retrieve.c
#   rkive/rkive.1
# Wrapped by kent@sparky on Sun Feb 24 16:11:22 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'rkive/Changes' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'rkive/Changes'\"
else
echo shar: Extracting \"'rkive/Changes'\" \(4054 characters\)
sed "s/^X//" >'rkive/Changes' <<'END_OF_FILE'
X@(#)Changes	2.1 2/21/91
XWARNING **** WARNING **** WARNING **** WARNING **** WARNING **** WARNING **** 
X
XThe .archived files now store the message id of the article instead of the
Xarticle number. This is done so that NNTP support could be added. The news
Xarticle numbering on one system may not be the same on another system and
Xworse yet, they might collide resulting in lost articles.  For this reason,
Xthe message-id is stored in the .archived file.  This complicates the maintance
Xof the .archived files greatly. Currently they are growing without bounds...
XIdeas please. A separate process run from cron to trim the files... ?? Help...
X
XWARNING **** WARNING **** WARNING **** WARNING **** WARNING **** WARNING **** 
X
XWhat follows is a list of changes that have occured during this release...
X------------------------------------------------------------------------------
X
X			general:
X
XModified the Makefile handle dependencies better.
X
XMoved the rkive.cf file into /usr/local/lib/rkive. This new directory
Xis being used to store all the external applications such as update_netdocs
Xas well.
X
XAdded the decompression routines to the compression suffix table.
X
Xrename.c used in the 1.x versions but is not used anymore...
X
XRemoved alot of duplicated code and added some more.
X
XRemoved the History lines from the files. Little, if any informational
Xcontent. Just bulks up the source files unnecessarily.  History is in
Xthe sccs files... If you really want it, send me email and I will send
Xyou prs output... :-)
X
X			article:
X
XAdded support for comp.archives auxiliary headers
X
XAdded support for comp.sources.apple2 extended auxiliary headers
X
XAdded compression recognition to article so that it can deal
Xtransparently with compressed/packed files. There is no longer
Xa need to "zcat filename | article".
X
X
X			rkive:
X
XAdded the ability to use the X-Checksun-Snefru: auxiliary header line
Xused in c.s.unix and comp.sources.misc.
X
XAdded the ability to archive comp.archives using the auxiliary headers
Xsupplied by the moderator's posting software.
X
XAdded the ability to archive comp.sources.apple2 using the extended
Xauxiliary headers.
X
XAdded the ability to pass parameter flags to the Compression utility
Xspecified in rkive.cf
X
XAdded NNTP support so that the archives can be maintained on a remote
Xsystem(s) In this manner as well, an archive site can use multiple
Xspool directories locatated on multiple systems to assure timely
Xupdate and better news access reliability.
X
XAdded the ability to support globbing.  rkive now allows the user to
Xspecify a match string to search for in the newsgroup. When a match is
Xfound, that article is archive. Only articles that match the specific
Xpatterns are archived. This mechanism works for all the different types
Xof archiving.
X
XAdded the ability for archive to execute external applications as
Xif it was done internally. It logs and writes index files for these
Xas specified in the rkive.cf configuration file.
X
XAdded the update_netdocs script and the appropriate entries in the 
Xsupplied rkive.cf. This script provides an example of how the
Xexternal archive mechanism works. It also allows a site to maintain
Xthe set of periodic postings that are specified in the rkive.cf and
Xthe update_netdocs. This script was a QUICK AND DIRTY EXAMPLE. It
Xneeds rewriting to be really used.
X
XRkive can now accept articles on stdin.
X
XRkive can now accept articles to be archived from a batch file
XThis allows the rkive use a batch file generated by the news system
Xin order to determine which articles need to be archived.
X
X#ifdef added to allow the volumes to be zero-padded so that volume1
Xnow becomes volume01
X
XAdded aditional format specifications to format.c so that the information
Xcontained in the rkive.cf file could be supplied to external commands
Xfor their specific use.
X
XDoes a better job going through saber and lint now.. :-)
X
XAdded the ability for the person configuring the rkive.cf to specify
Xwhere the .patchlog and .archived files are to reside. This was needed
Xfor maintaining uunet's c.s.misc archives.
X
END_OF_FILE
if test 4054 -ne `wc -c <'rkive/Changes'`; then
    echo shar: \"'rkive/Changes'\" unpacked with wrong size!
fi
# end of 'rkive/Changes'
fi
if test -f 'rkive/Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'rkive/Makefile'\"
else
echo shar: Extracting \"'rkive/Makefile'\" \(7759 characters\)
sed "s/^X//" >'rkive/Makefile' <<'END_OF_FILE'
X##########################################################
X#
X#	@(#)Makefile	2.2 2/23/91 - USENET Source Archiver
X#
X# This software is Copyright (c) 1989, 1990, 1991 by Kent Landfield.
X#
X# Permission is hereby granted to copy, distribute or otherwise 
X# use any part of this package as long as you do not try to make 
X# money from it or pretend that you wrote it.  This copyright 
X# notice must be maintained in any copy made.
X#
X# Use of this software constitutes acceptance for use in an AS IS 
X# condition. There are NO warranties with regard to this software.  
X# In no event shall the author be liable for any damages whatsoever 
X# arising out of or in connection with the use or performance of this 
X# software.  Any use of this software is at the user's own risk.
X#
X#  If you make modifications to this software that you feel 
X#  increases it usefulness for the rest of the community, please 
X#  email the changes, enhancements, bug fixes as well as any and 
X#  all ideas to me. This software is going to be maintained and 
X#  enhanced as deemed necessary by the community.
X#		
X#		Kent Landfield
X#		uunet!sparky!kent
X#		kent@sparky.imd.sterling.com
X#
X##########################################################
X#
X# Which mkdir function do you want to use ?
X#
X# Define HAVE_MKDIR if there is a mkdir() function in your 
X# system library (AT&T 5.2 or earlier systems are probably
X# out of luck..)
X#
X# Define USE_SYSMKDIR if you wish to system off /bin/mkdir.
X# (not recommended for *real* use...)
X#
X# If you do not define either, the function makedir will
X# create the directory itself. 
X#
X#MKDIR=
X#MKDIR=-DUSE_SYSMKDIR
XMKDIR=-DHAVE_MKDIR
X
X#
X# Do you wish to have this built with NNTP capabilities ?
X# This requires that you have networking libraries and the
X# NNTP source code available to you during compilation.
X#
X# EXCELAN support needed for nntp 
X#     Uncomment if needed...
X#
X#EXOSFLAGS = -I/usr/include/EXOS -DUSG -DEXCELAN
X#EXOSLIBS= -lsocket
X#
X# Specify the base directory location of the nntp sources
X#
X#NNTPSRCDIR=/usr/src/local/cmd/nntp
X##NNTPDEBUG=-DDEBUG
X#NNTPFLAGS=$(EXOSFLAGS) -I$(NNTPSRCDIR)/common -DNNTP $(NNTPDEBUG)
X#NNTPSRCS = $(NNTPSRCDIR)/common/clientlib.c nntpart.c
X#NNTPOBJS = clientlib.o nntpart.o
X
X#
X# Define your favorite C compiler here...
X#
XCC=cc
X#CC=gcc
X
X#
X# Compilation flags..
X#
XFLAGS=-g #-Wall
XCFLAGS=$(FLAGS) $(NNTPFLAGS) $(MKDIR) 
X
X#
X# Yacc flags for compilation of match.y
X#
XYFLAGS= #-v
XYACC=yacc
X
X#
X# Define flags to be passed to lint.
X#
XLINTFLAGS=$(NNTPFLAGS) $(MKDIR)
X
X# rkive needs to have POSIX Compatible directory access routines.
X# If you have it builtin to your system libraries then comment
X# out the following. If you use Doug Gwyn's routines, (or other
X# compatible routines) define the library in which they appear.
X#
X#ACCESSLIB=-lndir
X
XLDFLAGS=$(EXOSLIBS) $(ACCESSLIB)
X
X#
X# If your system requires additional libraries or if you wish to
X# use shared libraries, add the -llib declarations to LIBS below.
X#
X# LIBS = -lc_s
X
XI = /usr/include
XLP = lpr
XPR = nl -n
XNROFF = nroff
XBINDIR=/usr/local/bin
XRKIVEDIR=/usr/local/lib/rkive
XMAN1=/usr/man/man1
XMAN5=/usr/man/man5
X
XMANS=	$(MAN1)/article.1 \
X	$(MAN1)/rkive.1 \
X	$(MAN1)/ckconfig.1 \
X	$(MAN5)/rkive.5
X
XCONFIG=	$(RKIVEDIR)/rkive.cf 
X
XSCRIPTS= $(RKIVEDIR)/update_netdocs
X
XSUPPORT = Makefile README IDEAS MANIFEST
XINCLUDES = rkive.h article.h cfg.h patchlevel.h suffix.h
X
XARTICLE_SRCS =  article.c format.c header.c str.c version.c zfopen.c
XARTICLE_OBJS =  article.o afmt.o header.o str.o version.o zfopen.o
X
XCKCONFIG_SRCS = ckconfig.c disp_grp.c efopen.c setup.c str.c version.c
XCKCONFIG_OBJS = ckconfig.o disp_grp.o efopen.o setup.o str.o version.o
X
XARCHIVE_SRCS =  ck_name.c disp_grp.c efopen.c format.c header.c \
X		makedir.c news_arc.c $(NNTPSRCS) record_arc.c retrieve.c \
X		rkive.c setup.c str.c suffix.c version.c 
XARCHIVE_OBJS =  ck_name.o disp_grp.o efopen.o rfmt.o header.o \
X		makedir.o news_arc.o $(NNTPOBJS) record_arc.o retrieve.o \
X		match.o rkive.o setup.o str.o suffix.o version.o 
X
XSRCS = article.c ckconfig.c ck_name.c disp_grp.c efopen.c format.c \
X	header.c makedir.c news_arc.c nntpart.c retrieve.c rkive.c \
X	match.y record_arc.c setup.c str.c suffix.c version.c zfopen.c
X
XINSTALLED_PROGS=\
X	$(BINDIR)/article \
X	$(BINDIR)/ckconfig \
X	$(BINDIR)/rkive
X
XPROGS = article ckconfig rkive
X
Xall: $(PROGS) $(MANS) $(SCRIPTS)
X
X$(MANS):
X	cp `basename $@` $@
X	chmod 444 $@
X
Xinstall: $(MANS) $(SCRIPTS) $(CONFIG) $(INSTALLED_PROGS)
X
X$(INSTALLED_PROGS):
X	@strip $@ > /dev/null 2>&1
X	cp `basename $@` $@
X
X$(CONFIG):
X	cp `basename $@` $@
X	chmod 444 $@
X	
X$(SCRIPTS):
X	cp `basename $@` $@
X	chmod 755 $@
X
X$(RKIVEDIR) $(MAN1) $(MAN5):
X	mkdir $(MKDIRFLAGS) $@
X	chmod 775 $@
X
Xcf: $(CONFIG)
X
Xckconfig: $(CKCONFIG_OBJS)
X	$(CC) $(CFLAGS) -o ckconfig $(CKCONFIG_OBJS) $(LIBS)
X
Xarticle: $(ARTICLE_OBJS)
X	$(CC) $(CFLAGS) -o article $(ARTICLE_OBJS) $(LIBS)
X
Xrkive: $(ARCHIVE_OBJS)
X	$(CC) $(CFLAGS) -o rkive $(ARCHIVE_OBJS) $(LDFLAGS) $(LIBS)
X
X$(BINDIR)/article:	article
X$(BINDIR)/ckconfig:	ckconfig
X$(BINDIR)/rkive:	rkive
X
X################################
X#           Print
X################################
X
Xprint: print_docs print_support print_include 
X	$(LP) $(SRCS)
X
Xprint_support:
X	 $(PR) $(SUPPORT) | $(LP)
X
Xprint_include:
X	$(LP) $(INCLUDES)
X
Xprint_article:
X	$(LP) $(ARTICLE_SRCS)
X
Xprint_ckconfig:
X	$(LP) $(CKCONFIG_SRCS)
X
Xprint_rkive:
X	$(LP) $(ARCHIVE_SRCS)
X
Xprint_docs:
X	$(NROFF) -man $(DOCS) | $(LP)
X
X################################
X#           LINT
X################################
X
Xlint:  
X	@echo "linting Article sources: " > Lint.out
X	lint $(LINTFLAGS) $(ARTICLE_SRCS) | tee -a Lint.out
X	@echo "linting Ckconfig sources: " >> Lint.out
X	lint $(LINTFLAGS) $(CKCONFIG_SRCS) | tee -a Lint.out
X	@echo "linting Archiver sources: " >> Lint.out
X	lint $(LINTFLAGS) $(ARCHIVE_SRCS) | tee -a Lint.out
X
Xlint_article:
X	@echo "linting Article sources: " > Lint.out
X	lint $(LINTFLAGS) $(ARTICLE_SRCS) 2>&1 | tee -a Lint.out
X
Xlint_ckconfig:
X	@echo "linting Ckconfig sources: " > Lint.out
X	lint $(LINTFLAGS) $(CKCONFIG_SRCS) | tee -a Lint.out
X
Xlint_rkive:
X	@echo "linting Archiver sources: " > Lint.out
X	lint $(LINTFLAGS) $(ARCHIVE_SRCS) | tee -a Lint.out
X
X################################
X#      	    General        
X################################
X
Xclean:
X	rm -f *.o Lint.out *.bak
X
Xclobber: clean
X	rm -f $(PROGS)
X	rm -f y.output y.tab.h y.tab.c 
X
Xinspection:  
X	-inspect -abv $(ARTICLE_SRCS) 
X	-inspect -abv $(CKCONFIG_SRCS) 
X	-inspect -abv $(ARCHIVE_SRCS) 
X
Xinspect_rkive:
X	-inspect -abv $(ARCHIVE_SRCS) 
X
Xsaber_article_src:
X	#load $(CFLAGS) $(ARTICLE_SRCS) $(LIBS)
X
Xsaber_article_obj:
X	#load $(ARTICLE_OBJS) $(LIBS)
X
Xsaber_ckconfig_src:
X	#load $(CFLAGS) $(CKCONFIG_SRCS) $(LIBS)
X
Xsaber_ckconfig_obj:
X	#load $(CKCONFIG_OBJS) $(LIBS)
X
Xsaber_rkive_src:
X	#load $(CFLAGS) $(ARCHIVE_SRCS) $(LIBS)
X
Xsaber_rkive_obj:
X	#load $(ARCHIVE_OBJS) $(LIBS)
X
Xman:
X	$(NROFF) -man $(MANS)
X
Xdepend:
X	makedepend -- $(CFLAGS) -- $(SRCS)
X	
X################################
X#        Dependencies
X################################
X
Xclientlib.o: $(NNTPSRCDIR)/common/clientlib.c
X	$(CC) $(CFLAGS) $(TARGET_ARCH) -c $(NNTPSRCDIR)/common/clientlib.c
X
Xmatch.o: match.y article.h
X
X#
X# The format junk here could be cleaned up with -o if all
X# versions of make had it... I could reorg the code but that's
X# work... :-)
X#
Xrfmt.o: format.c
X	$(CC) -DRKIVE $(CFLAGS) $(TARGET_ARCH) -c format.c
X	mv format.o rfmt.o
X
Xafmt.o: format.c
X	$(CC) $(CFLAGS) $(TARGET_ARCH) -c format.c
X	mv format.o afmt.o
X
X$(RKIVEDIR)/rkive.cf:		rkive.cf $(RKIVEDIR)
X$(RKIVEDIR)/update_netdocs:	update_netdocs $(RKIVEDIR)
X$(MAN1)/article.1:		article.1 $(MAN1)
X$(MAN1)/rkive.1:		rkive.1 $(MAN1)
X$(MAN1)/ckconfig.1:		ckconfig.1 $(MAN1)
X$(MAN5)/rkive.5:		rkive.5  $(MAN5)
X
X# DO NOT DELETE THIS LINE -- make depend depends on it.
END_OF_FILE
if test 7759 -ne `wc -c <'rkive/Makefile'`; then
    echo shar: \"'rkive/Makefile'\" unpacked with wrong size!
fi
# end of 'rkive/Makefile'
fi
if test -f 'rkive/article.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'rkive/article.1'\"
else
echo shar: Extracting \"'rkive/article.1'\" \(5708 characters\)
sed "s/^X//" >'rkive/article.1' <<'END_OF_FILE'
X'br "@(#)article.1	2.2 2/23/91"
X.op 1i
X.TH ARTICLE 1
X.SH NAME
Xarticle \- print formatted news article header information
X.SH SYNOPSIS
X.B article
X[ -adnvV ] [-f format ] newsarticle [ ... ]
X.SH DESCRIPTION
X.I article
Xallows the user to display information contained in the news article 
Xheaders. This information includes the auxiliary headers added by the 
Xmoderators of most of the source newsgroups.
X.I article
Xtakes the names of article files from standard input or as specified 
Xon the command line. By default, 
X.I article 
Xproduces output in a format of:
X.PP
X(Newsarticle                 Article Subject)
X.br
Xsources.d/1210           Re:  Archiving USENET Software             
X.PP
XIf the user has specified that only potential archive members are to
Xbe displayed, article produces output in a format of:
X.PP   
X(Newsarticle  Archive Name           Article Description)
X.br
Xunix/1420   archive/part01   Source Archiver, Part 1 of 8
X.PP
XThe user can select almost any information contained within a news article
Xheader and can then specify the way in which the information should be
Xdisplayed. The format that the user specifies is much like that of a
XC printf statement. 
X.SH OPTIONS
X.IP "-a" 6
XPrint information (in the specified format if supplied) if and only if 
Xthe news article contains the auxiliary headers added by the sources 
Xnewsgroup moderators. Do not print any information about files that do 
Xnot contain auxiliary headers.
X.IP "-d" 
XTurn on debugging output. This option allows the user to display the 
Xinformation found in an article header. This is basically a formatted dump 
Xof the header structure after parsing the article's header.
X.IP "-f format"
XThis option allows the user to specify a format.  The format is used to 
Xdetermine which parts of the article header information are to be displayed. 
XIt also specifies the presentation format of the article information in 
Xmuch the same manner as the C printf function.  See Formatting below.
X.IP "-n" 
XPrint information (in the specified format if supplied) if and only if 
Xthe news article does not contains the auxiliary headers added by the 
Xsources newsgroup moderators.
X.IP "-v"
XPrint additional information about the newsgroup.
X.IP "-V"
XPrint the version and patchlevel of the current executable.
X.SH FORMATTING 
X.PP
X.I article
Xplaces output on the standard output stream stdout.  
X.I article 
Xselects, formats, and prints its output under control of the format.  
XThe format is a character string that contains two types of objects: 
Xplain characters, which are copied directly to the output stream, and 
Xselection specifications. Specifying a selection results in fetching 
Xthe selected items from the news article.  The results are undefined 
Xif there is no associated information found in the news article.
X.PP
XEach selection specification is introduced by the character %.  After 
Xthe %, a character follows that indicates the type of selection to be
Xmade.
X.PP
XThe selection characters and their meanings are:
X.nf
X
X		Article Information Lines
X
X        A - Print the Approved line.
X        C - Print the Control line.
X        D - Print the Date line.
X        E - Print the Reposted-by line.
X        F - Print the From line.
X        H - Print the Original-posting-by line.
X        I - Print the Original-subject line.
X        J - Print the Archive-directory.
X        K - Print the Keywords line.
X        L - Print the Lines line.
X        M - Print the Message-ID line.
X        N - Print the Newsgroups line.
X        P - Print the Path line.
X        Q - Print the Expires line.
X        R - Print the References line.
X        S - Print the Subject line.
X        T - Print the Subject Topic.
X        V - Print the Volume-Issue article filename.
X        W - Print the Architecture line.
X        X - Print the Version-number.
X        a - Print the Archive-name line.
X        b - Print the Submitted-by line.
X        c - Print the Supersedes line.
X        d - Print the Distribution line.
X        e - Print the Environment line.
X        f - Print the Followup-to line.
X        h - Print the X-Checksum-Snefru line.
X        o - Print the Organization line.
X        p - Print the Posting-number line.
X        r - Print the Reply-to line.
X        s - Print the Sender line.
X        t - Print the Patch-To line.
X        u - Print the Summary line.
X        w - Print the Archive-site line.
X        x - Print the Xref line.
X        y - Print the Archive line.
X
X		Archive Information 
X
X        B - Print the base file name.
X        G - Print the newsGroup name.
X        O - Print the Full path of the specified file.
X        i - Print the issue (if archive) line.
X        l - Print the Author's logon address line.
X        n - Print the Author's name.
X        v - Print the volume (if archive) line.
X
X		Additional Specification Characters 
X
X        T - Print the Subject line's topic information.
X        % - Print a %, no argument is converted.
X..nr
X.PP
XIn addition to the conversion characters, the following 
Xcharacters have meaning during the formatting of the output.
X.nr
X
X    \\n - Print a new-line in the output.
X    \\t - Print a tab in the output.
X.nf
X.SH EXAMPLES 
X.PP
XTo print all files in the sources directory that have auxiliary 
Xheaders and can be archived by Archive-Name or Volume-Issue methods:
X.PP
X$ find /usr/spool/news/comp/sources -print | article -a
X.PP
XTo print a list of files in 
X.PP
X$ cd /usr/spool/news/comp/sources; article -f"%O  %T" unix/*
X.RS
X.IP
Xunix/1843    Introduction to comp.sources.unix	
Xunix/1844    List of sources in the archives	
X.RE
X.SH "SEE ALSO"
Xrkive(1), ckconfig(1), rkive.cf(5)
X.SH BUGS
X.I article
Xdoes not know about the X-Archiver format used in Volume 1 of comp.sources.misc.
X.LP
END_OF_FILE
if test 5708 -ne `wc -c <'rkive/article.1'`; then
    echo shar: \"'rkive/article.1'\" unpacked with wrong size!
fi
# end of 'rkive/article.1'
fi
if test -f 'rkive/article.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'rkive/article.c'\"
else
echo shar: Extracting \"'rkive/article.c'\" \(6324 characters\)
sed "s/^X//" >'rkive/article.c' <<'END_OF_FILE'
X/*
X**  Subsystem:   USENET Sources Archiver             
X**  File Name:   article.c               
X**                                                        
X**  usage: article [ -adnvV ] [-f format ] newsarticle [ ... ]
X**
X**
X** This software is Copyright (c) 1989, 1990, 1991 by Kent Landfield.
X**
X** Permission is hereby granted to copy, distribute or otherwise 
X** use any part of this package as long as you do not try to make 
X** money from it or pretend that you wrote it.  This copyright 
X** notice must be maintained in any copy made.
X**
X** Use of this software constitutes acceptance for use in an AS IS 
X** condition. There are NO warranties with regard to this software.  
X** In no event shall the author be liable for any damages whatsoever 
X** arising out of or in connection with the use or performance of this 
X** software.  Any use of this software is at the user's own risk.
X**
X**  If you make modifications to this software that you feel 
X**  increases it usefulness for the rest of the community, please 
X**  email the changes, enhancements, bug fixes as well as any and 
X**  all ideas to me. This software is going to be maintained and 
X**  enhanced as deemed necessary by the community.
X**		
X**		Kent Landfield
X**		uunet!sparky!kent
X**		kent@sparky.imd.sterling.com
X*/
Xchar sccsid[] = "@(#)article.c	2.1 2/21/91";
X
X#include <stdio.h>
X#include <ctype.h>
X#include <sys/types.h>
X#include "rkive.h"
X#include "article.h"
X
X#define ARCHIVE_ONLY  1
X#define NO_ARCHIVE   -1
X
X#define USAGE  "usage: %s [ -adnvV ] [-f format ] newsarticle [ ... ]\n"
X
Xchar *progname;                 /* name of executable              */
Xchar *format_ptr = NULL;        /* pointer to user supplied format */
Xint verify_archive = 0;         /* archive verification needed ?   */
Xstruct group_archive *newsgrp;  /* newsgroup pointer for formating */
XFILE *errfp;                    /* standard error file pointer     */
XFILE *logfp;                    /* standard output file pointer    */
X
Xchar *strchr();                 /* external function declaration   */
Xvoid article_header();          /* local function declaration      */
X
Xint main(argc, argv)
Xint argc;
Xchar **argv;
X{
X   int getopt();
X   int strlen();
X   void version();
X
X   int c;
X   extern char *optarg;
X   extern int optind;
X   extern int opterr;
X
X   opterr = 0;
X   progname = argv[0];
X   debug = verbose = 0;
X   logfp = stdout;
X   errfp = stderr;
X
X   if (argc > 1) {
X      while ((c = getopt(argc, argv, "adnvVf:")) != EOF) {
X         switch (c) {
X             case 'a':
X                 verify_archive = ARCHIVE_ONLY;
X                 break;
X             case 'd':
X                 debug++;
X                 break;
X             case 'f':
X                 format_ptr = optarg;
X                 break;
X             case 'n':
X                 verify_archive = NO_ARCHIVE;
X                 break;
X             case 'v':
X                 verbose++;
X                 break;
X             case 'V':
X                 version();
X                 break;
X             default:
X                 (void) fprintf(errfp,USAGE, progname);
X                 return(1);
X         }
X      }
X   }
X
X   if ((optind >= argc) || (argc == 1)) {  /* file from stdin */
X        char buf[BUFSIZ];
X        while (fgets(buf,sizeof buf,stdin) != NULL) {
X               buf[strlen(buf) -1] = '\0';
X               article_header(buf);
X        }
X   }
X   else { 
X        for (; optind < argc; optind++)    /* process files to print */
X             article_header(argv[optind]);
X   }
X   return(0);                              /* terminate this process */
X}
X
Xvoid article_header(flname)
X    char *flname;
X{
X    int zfclose();
X    char *strcpy();
X    FILE *zfopen();
X    void init_article();
X    void store_line();
X    void dump_article();
X    char *format_output();
X
X    char *dp;
X    char *qp;
X    FILE *file;
X    int header_ok = 0;
X    int last = TEXT;
X
X    int default_format = ARTICLE;
X
X    init_article();
X
X    file = zfopen(flname,"r");
X
X    (void) strcpy(article.newsarticle,flname);
X
X    while (fgets(s,sizeof s,file) != NULL) {
X        /*
X        ** Check if the line is not a header line.
X        ** Allow 2 lines to go by that are not header
X        ** lines. In this manner, the auxilliary sources
X        ** headers can be interpreted.
X        */
X        if (!isalpha(*s) || (strchr(s,':') == NULL)) {
X           ++header_ok;
X           if (header_ok >= 2) {
X               /*
X               ** If the second line is another blank line,
X               ** keep searching. It may just be that the moderator
X               ** placed and extra blank line in the article by mistake.
X               ** Thanks to /r$ for the unique way of submitting bug
X               ** reports.. :-) :-)
X               */
X               if (*s == '\n' && last == BLANK)
X                   continue;
X               /* 
X               ** Has the user requested to produce 
X               ** only an archive listing ?
X               */
X               if (verify_archive == ARCHIVE_ONLY) {
X                  if (!header.archive_name[0] || !article.description[0])
X                       break;
X                   default_format = ARCHIVE;
X               }
X               /* 
X               ** Has the user requested to produce 
X               ** a listing excluding all archive 
X               ** potential members ?
X               */
X               else if (verify_archive == NO_ARCHIVE) {
X                   if (header.archive_name[0] && article.description[0]) 
X                       break;
X                   default_format = ARTICLE;
X               }
X               /* 
X               ** Print out the information as requested
X               */
X               qp = format_output(format_ptr, flname, default_format);
X               (void) fprintf(logfp, "%s\n", qp);
X
X               break;
X            }
X            if (*s == '\n')
X                last = BLANK;
X            else
X                last = TEXT;
X            continue;
X        }
X
X        last = TEXT;
X        dp = s;
X        while (*++dp)
X           if (*dp == '\n')
X               *dp = '\0';
X        /*
X        ** Determine the type of the line and then
X        ** store the line in its appropriate structure
X	** element for later retrieval.
X        */
X        store_line();
X    }
X    (void) zfclose(file);
X
X    if (verbose)
X        dump_article();
X}
END_OF_FILE
if test 6324 -ne `wc -c <'rkive/article.c'`; then
    echo shar: \"'rkive/article.c'\" unpacked with wrong size!
fi
# end of 'rkive/article.c'
fi
if test -f 'rkive/article.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'rkive/article.h'\"
else
echo shar: Extracting \"'rkive/article.h'\" \(5784 characters\)
sed "s/^X//" >'rkive/article.h' <<'END_OF_FILE'
X/*
X** 	@(#)article.h	2.2 2/23/91
X**
X*/
X
X#define BUFLEN    128    /* standard buffer size                     */
X#define LBUFLEN  1024    /* big buffer size                          */
X#define PATHLEN   512    /* length of longest source string          */
X#define DATELEN    64    /* length of longest allowed date string    */
X
X#ifndef TRUE
X# define TRUE        1    
X#endif
X
X#ifndef FALSE
X# define FALSE       0    
X#endif
X
X/*
X** Line content defines
X*/
X#define BLANK 0
X#define TEXT  1
X
X/*
X** Format output called from defines 
X*/
X#define ARCHIVE     1
X#define ARTICLE     2
X
X/*
X** Line type defines -  index uses
X*/
X
X#define FROM            	1
X#define PATH            	2
X#define NEWSGROUP       	3
X#define SUBJECT         	4
X#define MSG_ID	        	5
X#define REPLY_TO        	6
X#define REFERENCES      	7
X#define DATE            	8
X#define EXPIRE          	9
X#define CONTROL        		10
X#define SENDER         		11
X#define FOLLOWUP_TO    		12
X#define DISTRIBUTION   		13
X#define ORGANIZATION   		14
X#define NUMLINES       		15
X#define KEYWORDS       		16
X#define SUMMARY        		17
X#define APPROVED       		18
X#define SUPERSEDES     		19
X#define XREF           		20
X#define POSTING_NUMBER 		21
X#define SUBMITTED_BY   		22
X#define ARCH_NAME      		23
X#define ARTICLEID      		24
X#define PATCH_TO       		25
X#define X_CHECKSUM_SNEFRU	26
X#define ORIGINAL_POSTING_BY	27
X#define ORIGINAL_SUBJECT	28
X#define ARCHIVE_SITE		29
X#define ARCHIVE_DIRECTORY	30
X#define REPOSTED_BY		31
X#define VERSION_NUMBER		32
X#define ARCHITECTURE		33
X#define ARCHIVE_                34
X#define ENVIRONMENT             35
X#define OTHER          		99
X
X/* 
X** article header storage structure
X*/
X
X#define MAX_HEADERS    35 /* No 'other' here! */
X
X
Xstruct    header {
X    char    from[BUFLEN];         	/* From:                 */
X    char    path[PATHLEN];        	/* Path:                 */
X    char    nbuf[LBUFLEN];        	/* Newsgroups:           */
X    char    subject[BUFLEN];      	/* Subject:              */
X    char    ident[BUFLEN];        	/* Message-ID:           */
X    char    replyto[BUFLEN];      	/* Reply-To:             */
X    char    references[BUFLEN];   	/* References:           */
X    char    subdate[DATELEN];     	/* Date: (submission)    */
X    time_t  subtime;              	/* subdate in secs       */
X    char    expdate[DATELEN];     	/* Expires:              */
X    char    ctlmsg[PATHLEN];      	/* Control:              */
X    char    sender[BUFLEN];       	/* Sender:               */
X    char    followup_to[BUFLEN];  	/* Followup-to:          */
X    char    distribution[BUFLEN]; 	/* Distribution:         */
X    char    organization[BUFLEN]; 	/* Organization:         */
X    char    numlines[8];          	/* Lines:                */
X    int     intnumlines;          	/* Integer version       */
X    char    keywords[BUFLEN];     	/* Keywords:             */
X    char    summary[BUFLEN];      	/* Summary:              */
X    char    approved[BUFLEN];     	/* Approved:             */
X    char    xref[BUFLEN];         	/* Xref:                 */
X    char    supersedes[BUFLEN];   	/* Supersedes:           */
X    char    submitted_by[BUFLEN]; 	/* Submitted_by:         */
X    char    posting_num[BUFLEN];  	/* Posting-number:       */
X    char    archive_name[BUFLEN]; 	/* Archive-name:         */
X    char    patch_to[BUFLEN];     	/* Patch-To:             */
X    char    x_checksum_snefru[BUFLEN];	/* X-Checksum-Snefru:	 */
X    char    orig_poster[BUFLEN];	/* Original-posting-by:  */
X    char    orig_subject[BUFLEN];	/* Original-subject:     */
X    char    archive_site[BUFLEN];	/* Archive-site:         */
X    char    archive_dir[BUFLEN];	/* Archive-Directory:    */
X    char    reposter[BUFLEN];    	/* Reposted-by:          */
X    char    version_number[BUFLEN];	/* Version-number:       */
X    char    architecture[BUFLEN];    	/* Architecture:         */
X    char    archive[BUFLEN];		/* Archive:		 */
X    char    environment[BUFLEN];	/* Environment:		 */
X    char header[MAX_HEADERS][BUFLEN];   /* Index with header-codes */
X
X};
X
X/*
X** Type of archive file defines
X*/
X#define NORMAL         0
X#define INFORMATIONAL  1
X#define PATCH          2
X#define ADMINISTRATION 3
X
X/* 
X** archive information structure
X*/
X
Xstruct archive_rec {
X    char newsgroup[LBUFLEN];      /* news group            */
X    char newsarticle[LBUFLEN];    /* news article          */
X    char filename[BUFLEN];        /* destination file      */
X    int  volume;                  /* storage volume        */
X    int  issue;                   /* article issue number  */
X    int  rectype;                 /* type of article       */
X                                  /*   NORMAL article =  0 */
X                                  /*   INFORMATIONAL  =  1 */
X                                  /*   PATCH          =  2 */
X                                  /*   ADMINISTRATION =  3 */
X    int  repost;                  /* REPOST'ed article ?   */
X    int  patch_volume;            /* Initially posted      */
X                                  /*   storage volume      */
X    char package_name[BUFLEN];    /* Initially posted      */
X    char patch_issue[BUFLEN];     /* Initially posted      */
X                                  /* article issue numbers */
X    char description[BUFLEN];     /* information           */
X    char author_name[BUFLEN];     /* author full name      */
X    char author_signon[BUFLEN];   /* author sign on        */
X};
X
Xextern FILE *logfp;
X
X#ifndef ARTICLE_DEF
X#define ARTICLE_DEF 1
X    struct archive_rec article;
X    struct header header;
X    char s[BUFSIZ];
X    int debug;
X    int verbose;
X#else
X    extern char s[];
X    extern int debug;
X    extern int verbose;
X    extern struct archive_rec article;
X    extern struct header header;
X#endif /* ARTICLE_DEF */
END_OF_FILE
if test 5784 -ne `wc -c <'rkive/article.h'`; then
    echo shar: \"'rkive/article.h'\" unpacked with wrong size!
fi
# end of 'rkive/article.h'
fi
if test -f 'rkive/ckconfig.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'rkive/ckconfig.c'\"
else
echo shar: Extracting \"'rkive/ckconfig.c'\" \(6066 characters\)
sed "s/^X//" >'rkive/ckconfig.c' <<'END_OF_FILE'
X/*
X**  Subsystem:   USENET Sources Archiver             
X**  File Name:   ckconfig.c               
X**                                                        
X**  usage: config [ -gV ] [ -f config_file ] [ -n newsgroup ]
X**
X**
X** This software is Copyright (c) 1989, 1990, 1991 by Kent Landfield.
X**
X** Permission is hereby granted to copy, distribute or otherwise 
X** use any part of this package as long as you do not try to make 
X** money from it or pretend that you wrote it.  This copyright 
X** notice must be maintained in any copy made.
X**
X** Use of this software constitutes acceptance for use in an AS IS 
X** condition. There are NO warranties with regard to this software.  
X** In no event shall the author be liable for any damages whatsoever 
X** arising out of or in connection with the use or performance of this 
X** software.  Any use of this software is at the user's own risk.
X**
X**  If you make modifications to this software that you feel 
X**  increases it usefulness for the rest of the community, please 
X**  email the changes, enhancements, bug fixes as well as any and 
X**  all ideas to me. This software is going to be maintained and 
X**  enhanced as deemed necessary by the community.
X*/
Xchar sccsid[] = "@(#)ckconfig.c	2.2 2/23/91";
X
X#include <sys/types.h>
X#include <stdio.h>
X#include <pwd.h>
X#include <grp.h>
X#include "cfg.h"
X
X#define M1 "The following values are used if the administrator has"
X#define M2 "not set a value for a necessary configuration item(s)."
X#define USAGE  "usage: %s [ -gV ] [ -f config_file ] [ -n newsgroup ]\n"
X
Xextern struct passwd *pw;
Xextern struct group *gr;
X
Xstruct passwd *getpwuid();
Xstruct group *getgrgid();
X
Xchar *nwsg = NULL;
X
Xint main(argc,argv)
Xint argc;
Xchar **argv;
X{
X   int getopt();
X   void display_config();
X   void setup_defaults();
X   void version();
X
X   int c;
X   extern char *optarg;
X   extern int opterr;
X
X   opterr = 0;
X   logfp = stdout;
X   errfp = stderr;
X   progname = argv[0];
X   fill_in_defaults = 0;
X   config_file = LOCATION;
X
X   if (argc > 1) {
X      while ((c = getopt(argc, argv, "gVf:n:")) != EOF) {
X         switch (c) {
X             case 'f':
X                 config_file = optarg;
X                 break;
X             case 'g':
X                 fill_in_defaults++;
X                 break;
X             case 'n':
X                 nwsg = optarg;
X                 break;
X             case 'V':
X                 version();
X                 break;
X             default:
X                 (void) fprintf(errfp,USAGE, progname);
X                 return(1);
X         }
X      }
X   }
X   setup_defaults();
X
X   display_config();
X   return(0);
X}
X
X
Xvoid display_config()
X{
X    int strcmp();
X    void display_group_info();
X
X    register int i;
X    int first = 1;
X
X    (void) fprintf(logfp,"\n\t\tConfiguration Check for %s\n", config_file);
X
X    (void) fprintf(logfp,"\n\t\t\tGlobal Defines\n\n");
X
X    (void) fprintf(logfp,"News Directory:          %s\n",spooldir);
X    (void) fprintf(logfp,"Problems Directory:      %s\n",problems_dir);
X    (void) fprintf(logfp,"Global Logfile:          %s\n",
X                         *log ? log : "NO LOGGING");
X    (void) fprintf(logfp,"Global Index:            %s\n", 
X                         *mindex ? mindex:"NO INDEXING");
X    (void) fprintf(logfp,"Logfile Format:          %s\n",
X                         *log_format ? log_format : "NOT SPECIFIED");
X    (void) fprintf(logfp,"Index Format:            %s\n",
X                         *index_format ? index_format : "NOT SPECIFIED");
X    (void) fprintf(logfp,"Mail Results To:         %s\n\n", 
X                         *mail ? mail : "NO ONE");
X    (void) fprintf(logfp,"%s\n%s\n\n",  M1, M2);
X    (void) fprintf(logfp,"Archive Type:            %s\n",
X                    default_type == ARCHIVE_NAME ? "Archive-Name": 
X                    default_type == VOLUME_ISSUE ? "Volume-Issue":
X                    default_type == CHRONOLOGICAL ? "Chronological":
X                    default_type == COMP_ARCHIVES ? "Comp-Archives":
X                    default_type == ONLY_ARCHIVE_NAME ? "Only-Archive-Name":
X                    default_type == EXTERNAL_COMMAND ? "External-Command":
X                                                        "Article-Number"); 
X    if (default_type == EXTERNAL_COMMAND) {
X       /* Must have an ARCHIVE_CMD line... */
X       (void) fprintf(logfp,"Archive Command:         %s\n",
X                  *arch_command ? arch_command : "ERROR - NOT SPECIFIED");
X    }
X
X    (void) fprintf(logfp,"Patches Type:            %s\n",
X                  default_patch_type == PACKAGE ? "Package" : "Historical");
X
X    pw = getpwuid(default_owner);
X    (void) fprintf(logfp,"Default Owner:           %d <%s>\n", 
X                         default_owner,pw->pw_name);
X
X    gr = getgrgid(default_group);
X    (void) fprintf(logfp,"Default Group:           %d <%s>\n", 
X                         default_group, gr->gr_name);
X    (void) fprintf(logfp,"Default Modes:           %o\n", default_modes);
X    (void) fprintf(logfp,"Compression:             %s\n",
X                          *compress ? compress : "NO COMPRESSION");
X    (void) fprintf(logfp,"Checkhash:               %s\n",
X                          *checkhash ? checkhash : "NO CHECKHASH");
X#ifdef NNTP
X    if (*nntp)
X        (void) fprintf(logfp,"NNTP Archiving From:     %s\n", nntp);
X    else
X        (void) fprintf(logfp,"Archiving From:          LOCAL DISK\n");
X#endif /*NNTP*/
X
X    if (default_patch_type == PACKAGE && default_type != ARCHIVE_NAME) {
X        (void) fprintf(logfp,"WARNING: Package Patches archiving is only\n");
X        (void) fprintf(logfp,"         used with Archive-Name archiving.\n");
X    }
X
X    for (i = 0; i <= num; i++)  {
X         newsgrp = &group[i];
X         if (nwsg != NULL) {
X             if (strcmp(nwsg,newsgrp->ng_name) != 0)
X                 continue;
X         }
X         if (first) {
X            (void) fprintf(logfp,"\n\t\tNewsgroup Archive Configuration\n\n\n");
X            first = 0;
X         }
X         display_group_info(newsgrp);
X         (void) fprintf(logfp,"\n\n");
X    }
X    return;
X}
END_OF_FILE
if test 6066 -ne `wc -c <'rkive/ckconfig.c'`; then
    echo shar: \"'rkive/ckconfig.c'\" unpacked with wrong size!
fi
# end of 'rkive/ckconfig.c'
fi
if test -f 'rkive/retrieve.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'rkive/retrieve.c'\"
else
echo shar: Extracting \"'rkive/retrieve.c'\" \(6703 characters\)
sed "s/^X//" >'rkive/retrieve.c' <<'END_OF_FILE'
X/*
X** This software is Copyright (c) 1989, 1990, 1991 by Kent Landfield.
X**
X** Permission is hereby granted to copy, distribute or otherwise
X** use any part of this package as long as you do not try to make
X** money from it or pretend that you wrote it.  This copyright
X** notice must be maintained in any copy made.
X**
X*/
X
X#if !defined(lint) && !defined(SABER)
Xstatic char SID[] = "@(#)retrieve.c	2.1 2/21/91";
X#endif
X
X#include <sys/types.h>
X#include <sys/stat.h>
X#include <stdio.h>
X#include "rkive.h"
X
Xchar newsgroup_directory[MAXNAMLEN];
X
Xextern FILE *inputfp;              
Xextern char *batch_file;
X
Xextern FILE *errfp;                /* standard error file pointer     */
Xextern struct group_archive *newsgrp;
Xextern struct stat sbuf;
Xextern char spooldir[];
Xextern int retrieve;
Xextern int test;
X
Xint valid_disk_article(fullname,fl)
Xchar *fullname;
Xchar *fl;
X{
X    int stat();
X    /*
X    ** Assure that the file is in place 
X    */
X
X    if (stat(fl, &sbuf) != 0)  {
X        (void) fprintf(errfp,"can't stat %s - SKIPPING\n",fullname);
X        return(0);
X    }
X
X    /*
X    ** If its not a regular file, we can't archive it.
X    */
X
X    else if ((sbuf.st_mode & S_IFMT) != S_IFREG)
X        return(0);
X    
X    /* Check to assure that the file has a size greater that 0 */
X    /* Maybe I'm nuts but I don't see any reason to archive    */
X    /* files unless they contain something.. :-)               */
X       
X    else if (sbuf.st_size == 0) {
X        (void) fprintf(errfp, "%s is a Zero length file - SKIPPING\n",fullname);
X        return(0);
X    }
X    return(1);
X}
X
X/*
X** retrieve_article()
X**
X** The purpose of this function is to return the name of a file on disk
X** that contains a news article. It does not care if the the article has
X** or has not been archived at this point. There are currently four ways
X** to retrieve an article:
X**	1. Retrieve an article from a remote site via NNTP,
X**	2. Search the newsgroup directory for newsarticles,
X**	3. Receive a newsarticle filename on standard input,
X**	4. Receive newsarticle filenames from a batch file.
X*/
X
Xint retrieve_article(filename,which_time)
Xchar *filename;
Xint which_time;
X{
X    int chdir();
X    int strcmp();
X    int strlen();
X    int unlink();
X    int fclose();
X    char *strcpy();
X
X    FILE *efopen();
X#ifdef NNTP
X    int nntp_retrieve_article();
X#endif /*NNTP*/
X
X    char *rp;
X    static struct dirent *dp;
X    static DIR *dfd;
X    static char *dir = ".";
X    char ibuf[BUFSIZ];
X
X#ifdef NNTP
X    if (retrieve == FROM_NNTP) 
X         return(nntp_retrieve_article(filename,which_time));
X#endif /*NNTP*/
X
X    if (which_time == 1) {
X       (void) strcpy(newsgrp->ng_path, newsgrp->ng_name);
X       rp = newsgrp->ng_path; /* convert newsgroup name into a disk path */
X    
X        /*
X        ** convert all '.' to '/' to generate a path to the
X        ** newsgroup directory relative from the specified SPOOLDIR.
X        */
X    
X        while (*rp) {             /* convert all */
X            if (*rp == '.')       /* '.'s to '/' */
X                *rp = '/';        /* to create   */
X            rp++;                 /* the disk    */
X        }                         /* location    */
X    
X        (void) sprintf(newsgroup_directory,"%s/%s", spooldir,newsgrp->ng_path);
X    
X        if (chdir(newsgroup_directory) != 0) {
X            (void) fprintf(errfp,"change directory to %s failed, %s not archived\n",
X                                  newsgroup_directory, newsgrp->ng_path);
X            return(ERROR_ENCOUNTERED);
X        }
X    }
X
X    if (retrieve == FROM_DISK) {
X        /*
X        ** locate a file that needs to be archived. This is done by
X        ** a linear search of the directory with a linear search of
X        ** of the contents of the .archived file. If the file is not
X        ** specified in the .archived file, it has not been archived
X        ** before and we can proceed with the archiving.
X        */
X        if (which_time == 1) {
X            if ((dfd = opendir(dir)) == NULL) {
X                (void) fprintf(errfp, "can't open %s\n", newsgroup_directory);
X                return(ERROR_ENCOUNTERED);
X            }
X        }
X    
X        while ((dp = readdir(dfd)) != NULL) {
X           if (strcmp(dp->d_name,".") == 0 || strcmp(dp->d_name,"..") == 0)
X               continue;
X    
X           (void) sprintf(ibuf,"%s/%s", newsgroup_directory,dp->d_name);
X           /*
X           ** Check to assure the file is available and contains
X           ** some data...
X           */
X           if (!valid_disk_article(ibuf,dp->d_name)) 
X               continue;
X
X            (void) strcpy(filename,dp->d_name);
X            return(RETRIEVED);
X        }
X    
X        /* 
X        ** done reading the directory...
X        */
X        (void) closedir(dfd);
X        return(DONE);
X    }
X
X    /*
X    ** The following code is for retrieval types FROM_NAME and FROM_BATCHFILE
X    ** only. Any other type is an unknown software error ...
X    */
X    if (retrieve != FROM_NAME && retrieve != FROM_BATCHFILE) {
X        (void) fprintf(errfp, "Invalid retrieval type encountered - %d\n",retrieve);
X        return(ERROR_ENCOUNTERED);
X    }
X
X    /* 
X    ** If the user specified that a batchfile is to be used,
X    ** open the batchfile up so that the article names to 
X    ** archive can be read. Unlink it so that it does not
X    ** get in the way of other incoming articles. If the
X    ** batchfile cannot be unlinked, warn the user but
X    ** continue archiving. This is a non-fatal condition 
X    ** since we can determine if the article has been 
X    ** archived previously via the .archived file.
X    */
X
X    if (retrieve == FROM_BATCHFILE) {
X        if (which_time == 1) {
X            inputfp = efopen(batch_file,"r");
X            if (!test) {
X                if (unlink(batch_file) == -1) {
X                    (void) fprintf(errfp, 
X                          "Unable to unlink batchfile %s, continuing\n",
X                           batch_file);
X                }
X            }
X        }
X    }
X       
X    /*
X    ** Now retrieve the article to be archived from
X    ** the inputfp which could either be stdin or
X    ** the batchfile depending on what the user
X    ** specified on the command line.
X    */
X
X    while (fgets(ibuf,sizeof ibuf,inputfp) != NULL) {
X        ibuf[strlen(ibuf) -1] = '\0';
X
X        /*
X        ** Check to assure the file is available and contains
X        ** some data...
X        */
X        if (!valid_disk_article(ibuf,ibuf))
X            continue;
X
X        (void) strcpy(filename,ibuf);
X        return(RETRIEVED);
X    }
X
X    /* 
X    ** no more filenames on inputfp...
X    */
X
X    if (retrieve == FROM_BATCHFILE) {
X        (void) fclose(inputfp);
X        inputfp = stdin;
X    }
X    return(DONE);
X}
END_OF_FILE
if test 6703 -ne `wc -c <'rkive/retrieve.c'`; then
    echo shar: \"'rkive/retrieve.c'\" unpacked with wrong size!
fi
# end of 'rkive/retrieve.c'
fi
if test -f 'rkive/rkive.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'rkive/rkive.1'\"
else
echo shar: Extracting \"'rkive/rkive.1'\" \(8666 characters\)
sed "s/^X//" >'rkive/rkive.1' <<'END_OF_FILE'
X'br "@(#)rkive.1	2.3 2/24/91"
X.TH RKIVE 1
X.SH NAME
Xrkive \- archive USENET source groups
X.SH SYNOPSIS
X.B rkive
X[ -dstuvV ] [ -n newsgroup ]
X.SH DESCRIPTION
X.I rkive
Xis used to archive USENET sources groups, as well as general newsgroups,
Xto an alternate location as specified in an rkive configuration file. 
XArchives can be maintained in different ways:
X.PP 
X.I Archive-Name -
XThe moderators of most sources groups assign an official Archive-Name 
Xto each article that gets submitted to the net. In this manner, each file
Xhas a "new-login" or "elm/part06" type of format. For multi-part postings, 
Xa subdirectory is created (as indicated in the elm example) to hold the 
Xseparate "parts". This format is used by many large archive sites because 
Xit is easier for retrieval via mail request software such as netlib and 
Xthe filenames give hints as to what the software is. This type of archiving
Xis used specificially for archiving the moderated sources newsgroups.
X.PP 
X.I Volume-Issue -
XSoftware sent via most moderated groups have an assigned Volume and Issue 
Xnumber. This allows the moderators to track and reference the individual 
Xitems that have been posted to the group. Each individual article is given 
Xan "Issue" number. The Issues are grouped together into a "Volume". There 
Xare roughly 100 articles in each Volume but this is an arbitrary split 
Xtotally up to the moderator.  This format is extremely useful when the 
Xsoftware archives are cataloged. It makes searching of the files quicker
Xand verification of complete volumes easier. This archive format is 
Xrecommended for any site that will be doing massive searches of the 
Xindividual volumes since it keeps the quadratic nature of directory searches 
Xfrom making life miserable. This type of archiving is used specificially 
Xfor archiving the moderated sources newsgroups.
X.PP 
X.I Chronological -
XThis type of archiving can be used to store articles that do not have the
Xauxiliary headers. The articles are stored by the date the article is 
Xarchived. The articles are stored in a format of
X.PP
X	newsgroup/volume89/Jun/890627.01 
X.br
X		or
X.br
X	newsgroup/volumeYY/MOY/YYMMDD.II
X.PP 
Xwhere YY is the year, MM is the month, DD is the day, and II is the 
Xissue number archived that day. Depending on how the archive administrator
Xhas configured the rkive software, the MOY (month of year) may or may
Xnot be used. 
X.PP 
X.I Article Number -
XThe news software stores the articles locally by naming the news article 
Xby a number generated on every site. The Article Number ordering is unique 
Xto each site. If an Article Number archive is requested (or required by the 
Xnewsgroup), the news article file is copied to the directory specified in 
Xthe archive configuration file. The name of the archived article will match
Xthe original name generated by the news software.
X.PP
X.I External-Command - 
XThis type of archiving is being handled by a script/application outside of 
Xthe rkive program. In this situation, rkive locates the articles to be 
Xarchived, pipes the information about the article to an external command 
Xspecified in the configuration file. The external command processes the 
Xarticle as rkive waits for a success/failure status to be returned.  At 
Xthat point, rkive logs the status. Compression is the responsibility of the 
Xexternal command and is bypassed by rkive regardless of whether or not it 
Xis specified in the configuration file. Index records are written with the 
Xinfo as specified by the format. This means that the external command should 
Xknow about duplicates, reposts and compression.  When specifying an external 
Xcommand line in the rkive.cf file, information contained in the rkive.cf is 
Xavailable to be passed on the command line. The command line format is 
Xexpanded to see if the external command specified in the rkive.cf file has 
Xany parameters that need to be filled in. See rkive(5) for a description of 
Xthe information available and the format specifications.
X.PP
X.I Comp-Archives - 
XComp.archives supplies an Archive-name: but no volume information. It also
Xhas a separate set of auxiliary headers. For these reasons it has been treated 
Xas an separate type of archiving.  It could have been squeezed into ARCHIVE-NAME
Xbut that does not allow for easy changes in the future for either.
XThe header's archive_name contains the filename in an "elm/part06" format.
X.PP 
X.I Only-Archive-Name - 
XThis method of archiving works well for newsgroups such as alt.sources. 
XIt archives files *only* if they have Archive-name: lines in them. All 
Xother entries are silently ignored.  The header's archive_name contains 
Xthe filename in an "elm/part06" format.
X.PP 
X
XThis program is normally started from cron on a daily basis. Archiving
Xof newly arrived software is only done once for each file. If rkive 
Xis started daily, the posted sources are placed into the sources archive 
Xthe first day the software arrives on the machine instead of having to 
Xwait for expire -a to run.  Other methods for using rkive is to have it 
Xexecuted from the news sys file directly or have it use a batchfile of 
Xarticles that have arrived for the newsgroup that is being archived. It 
Xcan, of course, be executed from the command line.
X.PP
X
XBy means of a configuration file (see rkive(5)), the archive administrator
Xis able to control how archiving is performed. The administrator can specify
Xon a per newsgroup basis:
X.PP 
X.nf
X
X	o The type of the archiving, such as Volume-Issue
X	  Archive-Name, Article Number archiving, etc,
X	o Where the newsgroup archive is to be stored on disk,
X	o The location of log file for the newsgroup,
X	o The format of the logfile records,
X	o The location of index file for the newsgroup,
X	o The format of the index file records,
X	o A list of users to be sent mail when an article is archived,
X	o The owner/group and modes of each archived member, 
X	o Limiting archiving articles only to those whose header lines match a pattern,
X	o The method for archiving patches, whether with the package or inline,
X	o An external program to deal with the located articles,
X	o Whether the article is to be verified by some checksum mechanism,
X	o Whether the archived members should be compressed or not and
X	o Whether the news spool directory is local or accessed via NNTP.
X
X.nr
X.PP
X.SH OPTIONS
X.IP "-d" 6
XTurn on debugging output. This is more "verbose" than the verbose 
Xoption below.  (-v assumed)
X.IP "-f config_file"
XThis option allows the user to specify the file to be used as the 
Xrkive configuration file.
X.IP "-g"
XThis option allows the global default values to be displayed in the 
Xnewsgroup variables when there is nothing specified in the newsgroup 
Xentry of the configuration file. Only applicable with debugging and
Xif a verbose status is requested.
X.IP "-n newsgroup"
XThis restricts the execution to just the newsgroup indicated. The newsgroup
Xneeds to be specified in a "comp.sources.unix" format. Only one newsgroup 
Xcan be processed in this manner.  If this option is not specified, then all 
Xnewsgroups specified in the rkive configuration file are processed. 
X.IP "-s" 
XPrint a quick status of articles awaiting archiving that 
Xcurrently reside within the USENET newsgroup directories 
Xfor newsgroups specified in the rkive configuration file. 
X"rkive -vs" displays whether an article has been archived 
Xor if it is still waiting to be archived. If it has been 
Xarchived, the archived location is displayed.  "rkive -vvs"
Xprints out the newsgroups archive information in addition
Xto the output from an "rkive -vs" command.
X.IP "-t"
XTest only, no archiving is done. Print a report of all
Xactions that would take place if it was called without the 
Xtest flag.  (-v assumed)
X.IP "-u"
XUnconditionally archive the articles. Normally the software 
Xwill not overwrite an archive member if a file exists with
Xthe same name as the destination archived article. The use 
Xof this option ignores the check and overwrites an existing
Xarchive member. 
X.IP "-v"
XVerbose. Prints a file by file account of the actions.
X.IP "-B batchfile"
XArchive the files whose path names are specified in the "batchfile".
XThe use of this option requires that there be a newsgroup specified
Xthrough the use of the -n option above.
X.IP "-S newsgroup"
XArchive files whose path names are read from standard input. The
XThe newsgroup specified is the newsgroup information to be read
Xfrom the rkive.cf configuration file.
X.IP "-V"
XPrint the version number and patchlevel of the current executable.
X.IP "-?"
XDisplay a simple help usage message.
X.LP
X.SH FILES
X/usr/local/lib/rkive/rkive.cf
X.archived
X.patchlog
X.SH "SEE ALSO"
Xarticle(1), rkive.cf(5), ckconfig(1)
X.SH BUGS
XNone known.
END_OF_FILE
if test 8666 -ne `wc -c <'rkive/rkive.1'`; then
    echo shar: \"'rkive/rkive.1'\" unpacked with wrong size!
fi
# end of 'rkive/rkive.1'
fi
echo shar: End of archive 5 \(of 6\).
cp /dev/null ark5isdone
MISSING=""
for I in 1 2 3 4 5 6 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 6 archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0
exit 0 # Just in case...
-- 
Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
Sterling Software, IMD           UUCP:     uunet!sparky!kent
Phone:    (402) 291-8300         FAX:      (402) 291-4362
Please send comp.sources.misc-related mail to kent@uunet.uu.net.