SUMMARY [2]: Has anyone seen LP options changes under Solaris 10 (05/08)?

From: Matthew Stier <Matthew.Stier_at_us.fujitsu.com>
Date: Tue Aug 19 2008 - 17:57:50 EDT
Okay Solaris 10 0508 (S10u5) users, this is what I have done to resolve 
this issue at my facility.  [Note: I am running my Unix print server on 
a Solaris 8 system.]

My solution was to write a script that took the list of options on the 
command-line, and converts specified key=value pairs, to  keys only.  I 
then tucked the script way in a directory already in PATH  
(/usr/spool/lp/bin) and then I made a one line change in each interface 
script to filter the options assignment through my new filter.

The script itself is simple.  It steps though each key=value pair on the 
command-line and after checking a few special conditions, it checks to 
see if the current key being checked, is on the list of keys to be 
converted.  If it is, and the value portion is "true", the key is added 
to the return string.  If the value portion is "false", "no" is prefixed 
to the key, and the revised key is added to the return string.  If it is 
neither a special condition, or on the list of keys to be converted, it 
is added, as-is.  When all the options are processed, the revised list 
of options is printed to standard out.

#!/usr/bin/sh
# Convert PAPI key=value pairs into boolean keys
# i=index, k=key, o=options, r=return
o="letter legal ledger 11x17 simplex duplex hduplex portrait landscape
banner 2up 4up manual manenv tray1 tray2 tray3 tray4 tray5 bin1 bin2
auto postscript pcl hpgl2 hpgl2_p A3 A4 A5 B4-JIS B5-JIS B5-ISO"
r=
for i in ${@}
do
        case "${i}" in
        job-sheets=standard )
                i="banner";;
        job-sheets=none )
                i="nobanner";;
        *)
                k=`expr "${i}" : "^\([^=]*\)=*"`
                for j in ${o}
                do
                        if [ "${i}" = "${j}=true" ]; then
                                i="${k}"
                                break
                        fi
                        if [ "${i}" = "${j}=false" ]; then
                                i="no${k}"
                                break
                        fi
                done;;
        esac
        r="${r:+${r} }${i}"
done
echo ${r}

To integrate this script into the interface script, I simply modify the 
assignment line, when the fifth parameter ($5) is assigned to a 
variable, so it is pre-processed by my script.

As an example, the netstandard script (which I use for the bases of all 
my custom interfaces scripts) assigns several positional parameters to 
variables, and shifts the parameters to leave only filenames on the 
commandline.  During these assignements, positional variable $5 is 
assigned to option_list.  ( option_list=$5 ) I use this assignment to 
implement the filter.  (option_list=`scriptname "${5}"`)

Note: At my facility, I have three classes of prints.  HP Laserjets, 
Xerox DocuCentre's and a Xerox plotter.  I use a different script for 
each class, but it is basically the same script for each class, with 
only the options to be converted, that is different.

Matthew Stier wrote:
> Found it, and the only fix is to modify the 'interfaces' scripts to 
> accept both pre and post PAPI boolean options.
>
> With Solaris 10 05/08, Sun implemented the PAPI interface, to support 
> multiple printing back ends.  (BSD/IPP/CUPS/...)
>
> The lp command calls the papiAttributeListFromString() function to 
> process each option. 
>
>     
> http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/cmd/print/bsd-sysv-commands/lp.c
>     http://src.opensolaris.org/source/s?defs=papiAttributeListFromString
>
> The papiAttributeListFromString calls a _parse_attribute_list() 
> function, who job it is to process the numerous option argument 
> formats.  Near the end of the function, it process boolean (key only) 
> options. The first thing the boolean key code does is convert the 
> boolean key into a key=value pair, with the key being set to a value of 
> "true".  It then test the first two characters of the key to see if it 
> begins with "no". If it does, it removes the "no" prefix, and sets the 
> new key to "false".  (ie: "banner" becomes "banner=true". "nobanner" 
> becomes "banner=false".)
>
>     http://src.opensolaris.org/source/s?refs=_parse_attribute_list
>     (lines 853-861)
>
> Thus the only fix is to go through each interfaces script, and modify 
> the code that process the options, to accept both 'key' and 'key=value' 
> options.
>
>
> Jan Dreyer wrote:
>   
>> Hi,
>>
>> though your message is quiet old, I would like to point out, that we 
>> encountered similar problems with clients on HP-UX. Our solution was 
>> to fix the scripts which send the data and make little tweaks to our 
>> own scripts in .../interfaces.
>>
>> Did you find another solution or a hint what SUN changed?
>>
>> Greetings
>> Jan Dreyer
>>
>>
>> Matthew Stier schrieb:
>>     
>>> I've just deployed Solaris 10 (05/08) to a number of users, and an 
>>> encountering a problem with some /etc/lp/interfaces scripts I wrote 
>>> years ago.  This problems has not been encountered on any previous 
>>> release of Solaris 10, or 9, 8, 7, ...
>>>
>>> It appears that the latest release of Solaris 10 tweaks the 'lp' 
>>> options, modifying simple "options" into "option=value".  As an 
>>> example, if I specify "-o simplex" on the commandline, it is 
>>> forwarded to the (Solaris 8) printer server as "simplex=true".
>>>
>>> Google, SunSolve, and docs.sun.com have been fruitless so far.
>>>
>>> [demime 1.01b removed an attachment of type text/x-vcard which had a 
>>> name of Matthew_Stier.vcf]
>>> _______________________________________________
>>> sunmanagers mailing list
>>> sunmanagers@sunmanagers.org
>>> http://www.sunmanagers.org/mailman/listinfo/sunmanagers
>>>       
> _______________________________________________
> sunmanagers mailing list
> sunmanagers@sunmanagers.org
> http://www.sunmanagers.org/mailman/listinfo/sunmanagers
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Tue Aug 19 18:00:13 2008

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:44:11 EST