[net.sources] recordings in postnews, BSD version

chuqui@nsc.UUCP (Chuq Von Rospach) (04/08/84)

I went and hacked in the recordings patch that was posted by ihuxx!ignatz.
Since that was for the USG version of postnews, some changes had to be
made. Below is a version of postnews that will run on BSD system (and, I
believe, V7). It also includes Prentiss' fix for ignoring distributions
when being fed files. Enjoy!

chuq


-postnews -

#! /bin/sh
: '@(#)postnews.v7	2.8	4/23/83'
:
: 'modified 12/8/83 by Prentiss Riddle (riddle@ut-sally.UUCP) not to '
: '    ignore a Distribution specification when invoked with a       '
: '    filename argument.                                            '
:
: 'modified 4/7/84 by chuq von rospach (nsc!chuqui) to print out '
: 'recordings where appropriate. Based on version posted for usg by'
: 'nwuxd!dbaker'
:
: postnews: version 1.4 of 4/7/84
: 
: '@(#)postnews	1.4 (NSC) 4/7/84'
_NEWSLIB=/usr/lib/news
if test $# -gt 1 ; then
	/bin/echo "$0: Too many args"
	exit 1
fi
if test $# -eq 1 -a ! -r "$1" ; then
	/bin/echo "$0: Can't read $1"
	exit 1
fi
/bin/echo -n "Subject: "
read title
/bin/echo -n "Newsgroups (general): "
read ng
if test x$ng = x ; then
	ng=general
fi
: play recorded message
if test -s ${_NEWSLIB}/recording ; then
_rec1=${_NEWSLIB}/`cat -s ${_NEWSLIB}/recording|grep $ng|sed "s/^.*	//"` 
_tmp=`echo $ng |sed "s/\..*//"`
_rec2=${_NEWSLIB}/`cat -s ${_NEWSLIB}/recording|grep ${_tmp}.all|sed "s/^.*	//"`
fi
if test -f ${_rec1} ; then
cat -s ${_rec1}
fi
if test -f ${_rec2} ; then
cat -s ${_rec2}
fi
/bin/echo -n "Distribution ($ng): "
read dist
if test x$dist = x; then
	dist=$ng
fi
t=/tmp/pn$$
trap "sleep 1; cp $t $HOME/dead.article ; echo saved in $HOME/dead.article ; rm -f $t; exit" 1
trap "" 2
/bin/echo "Subject: $title" > $t
/bin/echo "Newsgroups: $ng" >> $t
if test $dist != $ng; then
	/bin/echo "Distribution: $dist" >> $t
fi
/bin/echo "" >> $t
case $# in
0)
	${EDITOR-vi} $t
	cd /tmp
	if inews -h <$t
	then
		:
	else
		if cat $t >>$HOME/dead.article
		then
			/bin/echo Article saved in $HOME/dead.article
		fi
	fi
	;;
1)
	cat $1 >>$t
	cd /tmp
	inews -h < $t
	;;
esac
sleep 1
rm -f $t

-- 
From under the bar at Callahan's:		Chuq Von Rospach
{amd70,fortune,hplabs,menlo70}!nsc!chuqui	(408) 733-2600 x242

A toast! To absent friends... {clink}