[net.unix-wizards] uucp request removal

damonp@daemon.UUCP (06/28/84)

[eat me]
Below is something I scraped together the other week. Slow, but
affective. Works only for X. jobs. Should be easily modified.
::::::::::::::
Xclean
::::::::::::::
:
: Xclean - clean up dead X.files
:
SPOOL=/usr/spool/uucp

mkdir $SPOOL/badX.
cd $SPOOL/X.

find . -type f -print\
| sed \
	-e 's:./::'\
	-e 's:.*:\
		if [ `/usr4/damonp/bin/Xclean.0 < &` = y ] ; then\
			mv & ../badX./&;\
		fi:' \
| sh
::::::::::::::
Xclean.0
::::::::::::::
:
: Xclean.0 - helper of Xclean
:
: Input:
:	The possibly offending X.file
:
: Output:
:	"y", if the file should be removed
:	"n", otherwise
:
SPOOL=/usr/spool/uucp
SITE=`uuname -l`

while read a1 a2 a3 a4 a5; do
	case $a1 in
		U|Z|C)
			;;

		I|F)
			case $a2 in
				D.${SITE}*)
					DIR=$SPOOL/D.$SITE
					;;

				*)
					DIR=$SPOOL/D.
					;;
			esac
			if [ ! -f $DIR/$a2 ] ; then
				echo $DIR/$a2 >>/tmp/X.missing
				echo "y"
				exit 0
			fi
			;;
	
		*)
			echo "Unknown card: $a1 $a2 $a3 $a4 $a5"
			exit 0
			;;
	esac
done

echo "n"
exit 0