[net.sources] savesource script

swatt (04/09/83)

I don't have space to save all news forever, but I decided some time
ago that net.sources was worth keeping around, hence "savesource".
Usage is from you news "sys" file:

	SOURCES:net.sources:B:/usr/lib/news/savesource [ srcdir ]

where <srcdir> is where you want the stuff to go.  In there will
appear the file "save.log", which contains the news header of
every news article saved, and files of the form:

	${month}_${day}.${unique}

(as in "Apr_8.4552"), each file containing an article.  The log
file will point to the saved article.  There is a lockout against
concurrent runnings of savesource.

You have to periodically go in by hand and delete obvious junk
(discussions and requests for stuff), and also to weed out which
version you want to keep if something is posted several times.
I have everything posted on net.sources since August 15th of last
year.

	- Alan S. Watt
	{decvax,duke,purdue,lbl-csam}!ittvax!swatt

sed 's/^X//' >savesource <<!EOF
X#! /bin/sh
X: '/*********************************************************************
X	savesource
X		Save sources sent over net.sources.
X		Called as a news forwarding program from inews
X
X	Alan S. Watt
X   
X	Sccsid="@(#)savesource	1.1 8/15/82 (ITT)"
X
X	usage:
X		savesource [ savedir ]
X
X	arguments:
X		savedir		Directory area to save sources (default
X				is /usr/lbgm).
X   
X	history:
X		08/15/82	original version
X   *********************************************************************/'
X
X: 'Public source directory (Little Bird Gave Me)'
Xsourcedir=${1-"/usr/lbgm"}
X
X: 'format of date command: "Sun Aug 15 15:56:06 EDT 1982"'
Xset `date`
Xmon=$2
Xday=$3
Xuniq=$$
Xtmp=svsrc.$$.tmp
Xlogfile=save.log
X
X: 'Lock the save source file and dump standard input there'
Xcd $sourcedir
X>$tmp
Xwhile savefile="${mon}_${day}.$uniq"
Xdo
X	if ln $tmp $savefile 2>&-
X	then
X		break
X	fi
X	uniq=`expr $uniq + 1`
Xdone
Xcat >${savefile}
Xrm -f $tmp
X
X: 'Dump the news header in a log file (up to a blank line)'
Xheader="$savefile:
X`sed -n '1,/^$/s/^/	/p' ${savefile}`"
Xecho "${header}" >>$logfile
!EOF