aboutsummaryrefslogtreecommitdiff
path: root/lp/kill
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-08-31 02:15:45 +0000
committerrsc <devnull@localhost>2005-08-31 02:15:45 +0000
commit2863ba101f0c9fec34756948e263cd534a3634ee (patch)
treedf27f79892119c8ff008bcfd25065bc20a76a494 /lp/kill
parent6174642093bdcef4116ae78dbdf4f2e608494258 (diff)
downloadplan9port-2863ba101f0c9fec34756948e263cd534a3634ee.tar.gz
plan9port-2863ba101f0c9fec34756948e263cd534a3634ee.tar.bz2
plan9port-2863ba101f0c9fec34756948e263cd534a3634ee.zip
Missed this.
Diffstat (limited to 'lp/kill')
-rwxr-xr-xlp/kill/generic29
1 files changed, 29 insertions, 0 deletions
diff --git a/lp/kill/generic b/lp/kill/generic
new file mode 100755
index 00000000..f6c472b9
--- /dev/null
+++ b/lp/kill/generic
@@ -0,0 +1,29 @@
+#!/usr/local/plan9/bin/rc
+if (! ~ $DEBUG '') flag x +
+
+cd $LPSPOOL
+if (~ $#* 0) KILLARGS=`{sed 1q};
+if not KILLARGS=$*;
+
+if (test -d $LPDEST) {
+ for (i in $KILLARGS) {
+ for (j in `{lpsub sched $SCHED $LPDEST}) {
+ if (test -r $LPDEST/$j^id) {
+ STATLINE=`{cat $LPDEST/$j^id}
+ if (~ $STATLINE(1)^$STATLINE(3) $i)
+ if (rm $LPDEST/$j $LPDEST/$j^id >/dev/null >[1=2])
+ echo $i removed from $LPDEST queue on $THIS_HOST
+ }
+ }
+ }
+}
+if (! ~ $THIS_HOST $DEST_HOST) {
+ @{echo -d$LPDEST -k;echo $KILLARGS;sleep 7} | lpsend.rc $DEST_HOST
+}; if not {
+ if (! ~ $KILLCMD '') {
+ for (i in $KILLARGS) {
+ $KILLCMD $i;
+ }
+ }
+}
+exit ''