On Mon Jul 22 07:53:02 EDT 2013, lu...@proxima.alt.za wrote:
> in /sys/lib/lp/bin/lpsend.rc the following lines seem altogether wrong
> to me:
> 
>       6: if (~ $#dialstring 0 || ! ~ $dialstring '') {
>       7:     dialstring=$1

certainly wierd.

i read this as trying to convert from sys→dom.  if that does
not work, just use $1.  otherwise use the resulting dom
returned from ndb/query.

for me, tcp!sysname!printer will work whenever
tcp!domname!printer will work.  also hard-coding tcp is
incorrect.  the connection server fixes that for you.
all this code seems to make things more fragile, and
less general.

i would think this code would make more sense.

        #!/bin/rc
        lpsend $1 || exit lpsend: $status

however, since lpsend.c doesn't call netmkaddr like one would
expect, i think you'll need to add change it to this

        fn netmkaddr{
                # lpsend is calls dial with incorrect arguments; should be
                # dial(netmkaddr(dialstring, "tcp", "printer"), 0, 0, 0)
                # please fix that, and remove this function.
                defnet=tcp
                defservice=printer

                ifs='! ' {x=`{echo -n $1}}
                switch($#x){
                case 1
                        echo $defnet!$1!$defservice
                case 2
                        # bad hueristics
                        if(~ $x(1) net || test -e /net/$x(1)/clone || ~ $x(1) 
*/*)
                                echo $x(1)^!^$x(2)^!$defservice
                        if not
                                echo $defnet!$x(1)^!$x(2)
                case *
                        echo $1
                }
        }
        lpsend `{netmkaddr $1} || exit lpsend: $status

Reply via email to