lp wrapper for filtering out priority 0 (zero) print jobs on Solaris "lp -q 0 /file"

Brian Jester bjester at maximsys.com
Tue Aug 23 13:51:17 PDT 2005


Background:
We have a legacy application that defaults to a print job priority of 0 (zero).  The app is hard coded with: "lp -q 0 /file"  CUPS allows print priorities of 1 - 100.
Platform: Sun Blade 150, Solaris 8 2/04, HP LJ4000 PS printer

Problem:
Using CUPS, and CUPS lp binary, we were unable to print from our legacy application, and we (thankfully) received an error message, "lp: Priority must be between 1 and 100".  Also, the (legacy) man page for Solaris lp was misleading because we were not reading the correct (CUPS) lp man page.

Solution:
Wrote a small lp wrapper to "sed" out the priority 0 (zero) "q 0" argument and replace it with priority 1 (one) "q 1".

1. From a root xterm:
   mv /usr/bin/lp /usr/bin/lp.ORIG

2. vi /usr/bin/lp
     i
     #This is the lp wrapper
     ARG=$*
     echo $ARG > /tmp/ARG.$$
     cat /tmp/ARG.$$ | sed -e 's/q 0/q 1/' > /tmp/NEWARG.$$
     NEWARG=`cat /tmp/NEWARG.$$`
     /usr/bin/lp.ORIG $NEWARG
     rm /tmp/ARG.* /tmp/NEWARG.*
     <ESC>:wq!
   chmod 555 /usr/bin/lp
   chown root:sys lp

Semper Fi!

Brian Jester
Maxim Systems Inc.
SPAWAR SC SD
619-553-5321






More information about the cups mailing list