patch for lpq output parsing for LPRng

James Henstridge james at daa.com.au
Mon Jul 8 01:27:02 GMT 2002


[please keep me in the CC line for replies, as I am not subscribed to 
this list]

Since upgrading one of our servers that handles a number of print queues 
to Red Hat 7.3, I started getting complaints about jobs not getting 
removed from the print queues -- they would get printed, then their 
status would change to paused in the print queue dialog on the Windows 
machines.  This also meant that the printer icon in the system tray 
didn't disapear, which a number of users used to check when their job 
had finished printing.

This problem occurs because the version of LPRng (3.8.9) that ships with 
RH7.3 lists the last few finished jobs in the output of lpq with their 
rank listed as "done".  The output looks something like this:

Printer: hp5100 at blinky (dest auto at hp5100)
 Queue: no printable jobs in queue
 Server: no server active
 Status: job 'james at blinky+708' saved at 16:06:16.677
 Rank   Owner/ID                  Class Job Files                 Size Time
done   carole at blinky+580            A   580 smbprn.007629.i16aS5 99120 
10:34:44
done   james at blinky+708             A   708 smbprn.000024.rW1nDr 72089 
16:06:16
JetDirect lpd: no jobs queued on the port Auto

I wrote a simple patch to solve this problem.  If it encounters a print 
job with its rank set to "done", it sets the status field to LPQ_PRINTED 
(which seems like the most appropriate status).  This seems to solve the 
problem for us -- the completed jobs don't show up paused, and the 
printer icon in the system tray disapears when the job completes.

It would be useful to get this patch included in future 2.2 releases.

James Henstridge.

-- 
Email: james at daa.com.au              | Linux.conf.au 2003 Call for Papers out
WWW:   http://www.daa.com.au/~james/ |   http://conf.linux.org.au/cfp.html


-------------- next part --------------
--- samba-2.2.5/source/printing/lpq_parse.c.lprng-lpq	Mon Jul  8 13:59:03 2002
+++ samba-2.2.5/source/printing/lpq_parse.c	Mon Jul  8 14:00:10 2002
@@ -257,6 +257,8 @@
 
   if (strequal(tokarr[LPRNG_RANKTOK],"active")) {
     buf->status = LPQ_PRINTING;
+  } else if (strequal(tokarr[LPRNG_RANKTOK],"done")) {
+    buf->status = LPQ_PRINTED;
   } else if (isdigit((int)*tokarr[LPRNG_RANKTOK])) {
     buf->status = LPQ_QUEUED;
   } else {


More information about the samba-technical mailing list