Subject: Re: Link with news.

From: Simon Michael <[email-masked]>
Date: Thu, 1 Sep 1994 16:29:25 -0700

Steve Morris writes:
 > I suppose this isn't really the right place to ask but what tools
 > are available to read newsgroups and extract posts into mail
 > folders. I use emacs vm (as of today) and procmail.

Here's what I'm using to extract posts and copy to a mailing list -
suggestions appreciated :

#!/bin/csh -f
# scans news spool for messages to mirror on the mailing list
# called by cron every 15 minutes or so

set LOG = $LISTDIR/local-sw/mirror-news.log
echo "" >> $LOG
echo ========`date`======== >> $LOG

foreach i ($NEWSSPOOL/local/sw/*)

	# some paranoid checks because this generated a lot of garbage
	# once when the file system filled up.. ?
	if (!(-e $i)) then
		echo "$i - nonexistent file" >> $LOG
	else if (-z $i) then
		echo "$i - empty file" >> $LOG
	else
		egrep "^X-Loop: local-sw" $i >/dev/null
		if ($status == 0) then
			echo "$i - from mailing list" >> $LOG
		else
			# messages posted to the group will be forwarded to flist
			# repeatedly, flist will check its msgid cache and discard..
			# could use that mechanism here, or grep the logfile..
			echo "$i - mirroring" >> $LOG

			cat $i \
			|$LISTDIR/.bin/formail -I"To: [email-masked]" -IPath: -IDistribution: \
			|$LISTDIR/.bin/flist local-sw
		endif
	endif
end