: '@(#) postnews.v7	2.5	6/21/82'
if test $# -gt 1 ; then
	echo "$0: Too many args"
	exit 1
fi
if test $# -eq 1 -a ! -r "$1" ; then
	echo "$0: Can't read $1"
	exit 1
fi
echo -n "Title: "
read title
echo -n "Newsgroups (general): "
read ng
if test x$ng = x ; then
	ng=general
fi
case $# in
0)
	if test x$EDITOR = x
	then
		echo "Type news, end with control D"
		inews -t "$title" -n $ng
	else
		t=/tmp/pn$$
		trap "sleep 1; rm -f $t; exit" 0 1 2
		$EDITOR $t
		if inews -t "$title" -n $ng <$t
		then
			:
		else
			if cat $t >>$HOME/dead.news
			then
				echo Article saved in $HOME/dead.news
			fi
		fi
	fi
	;;
1)
	inews -t "$title" -n $ng < $1
	;;
esac
