#!/bin/sh

# Try to use cnews or inn automatically

NEWSX=/usr/lib/news/bin/newsx.real

if [ -e /usr/lib/news/config -a -e /etc/news/sys ] ; then
	#cnews found
	exec $NEWSX --cnews --newsfeeds /etc/news/sys $*
elif [ -e /var/run/news -a -e /var/spool/news/outgoing ] ; then
	#inn2 found
	exec $NEWSX --inn --batch /var/spool/news/outgoing \
	--incoming /var/spool/news/incoming \
	--spool /var/spool/news/articles $*
elif [ -e /var/run/innd -a -e /var/spool/news/out.going ] ; then
	# inn (1.*) found
	exec $NEWSX --inn $*
else
	echo "Neither cnews nor inn was found. Either fix this or call $NEWSX directly" >&2
	exit 3
fi
