[alt.sources] rn cancel macro update

maart@cs.vu.nl (Maarten Litmaath) (01/11/90)

Now the `Distribution:' field is set correctly (= limited!).

----------8<----------8<----------8<----------8<----------8<----------
#!/bin/sh
# @(#)cancel 1.1 89/12/30 Maarten Litmaath
# cancel <path-to-article>

INEWS=/usr/lib/news/inews
# figure out if echo is BSD or SYSV
test "x`echo -n x`" = xx && n=-n c= || n= c=\\c

test $# = 1 || {
	echo "Usage: `basename $0` <path-to-article>" >&2
	exit 1
}

NEWSGROUPS=`sed -n -e '/^Newsgroups: /{' -e 's///' -e p -e q -e '}' "$1"`
IDENT=`sed -n -e '/^Message-ID: /{' -e 's///' -e p -e q -e '}' "$1"`
DISTRIBUTION=`
	sed -n -e '/^$/q' -e '/^Distribution: /{' -e s/// -e p -e q -e '}' "$1"
`
test x"$DISTRIBUTION" = x && DISTRIBUTION=world

echo "Confirm cancel of article $IDENT in"
echo $n "$NEWSGROUPS: [ny] $c"
read ans
test x"$ans" = xy &&
	$INEWS -c "cancel $IDENT" -n "$NEWSGROUPS" -d "$DISTRIBUTION" \
		< /dev/null
----------8<----------8<----------8<----------8<----------8<----------
-- 
1755 EST, Dec 14, 1992: Henry Spencer is put on a one-way mission to the moon.|
  Maarten Litmaath @ VU Amsterdam:  maart@cs.vu.nl,  uunet!mcsun!botter!maart