[net.sources] ilprm.icn--Interactivates the lprm command

whm (02/14/83)

#
# 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