Plan 9 from Bell Labs’s /usr/web/sources/contrib/boyd/sys/src/cmd/dws.html

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


<html>
<body>
<pre>
<tt>
#!/bin/sh

# dws [ box ] [ id ]
#
# die worthless spammer

myname="`basename \"$0\"`"
spam=+spam

case "`box`" in
$spam)
	echo "$myname: Replying to a spam in \"$spam\"?" 1&gt;&amp;2
	exit 1
	;;
esac

case $# in
0|1|2)
	mov ${1+"$@"} "$spam" || exit $?
	;;

*)
	echo "usage: $myname [ box ] [ id ]" 1&gt;&amp;2
	exit 1
	;;
esac

box="`box`"

box "$spam" || exit $?

# construct reply
(
	EDITOR='sam -d' rep -i &gt; /dev/null 2&gt;&amp;1 &lt;&lt;'!'
/^To:.*\n(    .*\n)+/
x/\n    /c/ /
/^To:.*\n/
.t.
x/[\-a-zA-Z0-9._&amp;]+@/c/postmaster@/
/^To:.*\n/
/^To:.*\n/
s/^To:/Cc:/
,x/^Cc: \n/d
,x/^Bcc: \n/d
,x/^Subject: \n/d
1,/^\n/
a
die, worthless spammer.

postmaster: check out the Mail Abuse Protection System (MAPS)
	    http://maps.vix.com

.
1,/^$/p
w
q
!
# log reply and deliver
) || exit 1

case "$myname" in
dws)
	echo "$myname: Spam returned to `msg | 822flatten | sed -e '/^[TC][oc][ 	]*:[ 	]*/!d' -e 's///' | tr '\012' ' '`" 1&gt;&amp;2
	del &amp;&amp; box "$box"
	;;

rws)
	med
	;;
esac
</tt>
</pre>
<HR>
&copy 1998,
Boyd Roberts:
<A HREF="mailto:[email protected]">[email protected]</A>
</body>
</html>

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].