[net.sources] postnews fix

ignatz@ihuxx.UUCP (Dave Ihnat, Chicago, IL) (03/25/84)

This is being posted exactly as received.  Any questions or comments,
please mail to the submitter, not me.
----------------------------------------------------------------------

From uucp Fri Mar 23 23:28 EST 1984
>From dbaker Fri Mar 23 22:28 CST 1984 remote from nwuxd
To: ihuxx!ignatz
Subject: please post
Status: R

Dave,
	Since they're still imposing the posting ban would you please
	post this to net.sources. With a note to net.news.b that this
	fixes postnews not playing the appropriate message. You may
	wish to test it before posting since I generalized after the
	plugged by ability to post.
					Thanks,
						Darryl
---------------------------------T.o.D.L.--------------------------

: '@(#)postnews.usg	2.?	2/21/84'
: define your news lib directory
_NEWSLIB=/usenet/lib
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 "Subject: " \\c
read title
/bin/echo "Newsgroups (general): " \\c
read ng
if test x$ng = x ; then
	ng=general
fi
: play recorded message
if test -s ${_NEWSLIB}/recording
	cat -s `cat -s ${_NEWSLIB}/recording|grep $ng|sed "s/^.* //"` /dev/null
_tmp=`echo $ng |sed "s/\..*//"`
	cat -s `cat -s ${_NEWSLIB}/recording|grep ${_tmp}.all|sed "s/^.* //"` /dev/null
fi
/bin/echo "Distribution ($ng): " \\c
read dist
if test x$dist = x; then
	dist=$ng
fi
t=/tmp/pn$$
case $# in
0)
	trap "sleep 1; cp $t $HOME/dead.article ; /bin/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
	${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)
	cp $1 $t
	cd /tmp
	inews -t "$title" -n $ng < $t &
	;;
esac