Plan 9 from Bell Labs’s /usr/web/sources/plan9/sys/lib/lp/kill/generic

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


#!/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 `{bind -b $LPLIB/sched /bin;$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 ''

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.