From: utzoo!decvax!harpo!utah-cs!arizona!whm
Newsgroups: net.sources
Title: ilprm.icn--Interactivates the lprm command
Article-I.D.: arizona.1329
Posted: Mon Feb 14 01:37:47 1983
Received: Wed Feb 16 05:18:38 1983

#
# ilprm.icn - interactively remove jobs from line printer queue
#
#  Reads the output of "lpq", printing the line for each entry and
#   following it with a "? ".  A response starting with a Y or y indicates
#   that the entry is to be removed.
#
global rmlist
procedure main()
	lp := open("/usr/ucb/lpq","rp")
	line := read(lp)
	if (find("is empty",line)) then
		stop(line)
	else
		write(line)
	while line := read(lp) do {
		writes(line,"? ")
		map(read()) ? {match("y") & zap(line)}
		}
	every system("lprm " || !\rmlist)
end
procedure zap(line)
	initial rmlist := []
	line ? {
		tab(upto(' '))
		tab(many(' '))
		put(rmlist,tab(upto(' ')))
		}
end