[alt.sources] rn cancel macro + script

maart@cs.vu.nl (Maarten Litmaath) (12/22/89)

On many (most?) rn installations the `C' cancel command ALWAYS results in:

	You can't cancel someone else's article

This article offers a work-around.  Put the following rn macro in the file
`.rnmac' in the directory containing your `.newsrc'.

----------8<----------8<----------8<----------8<----------8<----------
C	%(%m=[ap]?!cancel %A^J:C)
----------8<----------8<----------8<----------8<----------8<----------

Put the following `cancel' command somewhere in your PATH.

----------8<----------8<----------8<----------8<----------8<----------
#!/bin/sh
# cancel <path-to-article>
# author: maart@cs.vu.nl

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"`

echo "Confirm cancel of article $IDENT in"
echo $n "$NEWSGROUPS: [ny] $c"
read ans
test x"$ans" = xy &&
	$INEWS -t "cmsg cancel $IDENT" -n "$NEWSGROUPS" < /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