#! /bin/sh
# Check for existence of files in a batch, passing through only batchfile
# entries for files that exist.  -v reverses sense of test.

# =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
. ${NEWSCONFIG-/usr/local/lib/news/bin/config}

PATH=$NEWSCTL/bin:$NEWSBIN/batch:$NEWSBIN:$NEWSPATH ; export PATH
umask $NEWSUMASK

case "$1" in
-*)	opt="$1" ; shift	;;
esac

cd $NEWSARTS
while read name rest
do
	out=n
	case "$name" in
	'<'*'>')	out=y	;;
	*)	if test -f "$name"
		then
			out=y
		fi
		;;
	esac
	case "$out$opt" in
	y|n-v)	echo "$name $rest"	;;
	esac
done
