SUMMARY: print filter works with lpr, not with lp

From: Josh Kuperman (jkuperma@ogs.state.ny.us)
Date: Fri Mar 01 1996 - 13:14:50 CST


First, let me apologize to the list - the solution to my problem is for me
to stop being an idiot. The reason my filter was working was I was sending
it to the wrong printer, i.e. I never sent the file to the printer that
invoked the filter. When I send my file to the right printer, the filter
works.

Second, let me apologize to the list for not providing enough information.
On our installation of SunOS 4.1.3 (and many others I thought) the lp
command is simply the lpr command. The major difference being that it
checks the command line so that it interprets the command line options
(e.g. -P ps1 for lpr would be -d ps1 for lp). I did receive some perfectly
correct responses pointing out that lp - real lp as Solaris does it -
doesn't use printcaps - and of course this is true.
nys209:/usr2/accts/jkuperma> ls -l /usr/bin/lp
lrwxrwxrwx 1 root 10 Dec 5 14:28 /usr/bin/lp -> ../ucb/lpr

Finally, I should have explained my setup. The printcap file is on an old
ELC on my desk, rather than send any printfiles to another printer on the
network I run a Macintosh program called lpDaemon which sends the
printfiles to a LaswerWriter Pro on my desk. Actually it comes to the Mac
on my desk and the lpDaemon sends it to the printer, since I don't have
enought network connections or connectors to put the printer on the network
directly.. joshK in the printcap file is my Macintosh's address on the
network.

ps|joshPS|joshps printer:\
        :mx#0:lp=:rm=joshk:rp=JoshPS:\
        :sd=/var/spool/printers/joshps:\
        :lf=/var/spool/printers/joshps/log:
lp|line printer:\
        :mx#0:sh:lo=lock:\
        :lp=/dev/null:\
        :sd=/var/spool/printers/lp:\
        :lf=/var/spool/printers/lp/log:\
        :if=/usr/bin/lp.filter:

This is the filter please note that all the logging and messages show up on
my personal machine. So please don't think that the messages are intended
to be meaningful - I just wanted something to print even if the filter
worked so I'd know that the filter was being invoked. This enabled me to
realize why I was being stupid (see above). I felt I needed to add that
just in case a future potential employer, who hates logging messages about
munchkins, sees this, though I suspect that's unlikely. Also I should note
that the highly simplified filter was derived from the helpful responses I
received and summarized a couple of months ago when I asked questions on
how to set this up.

nys209:/pr75/source> cat /usr/bin/lp.filter
#!/bin/sh
# printcap input filter that takes input from wherever and converts
# it to postscript toprint on my desk
FILTER=/usr/bin/a2ps

if [ ! -x $FILTER ]
then
        /usr/ucb/logger -p "auth.notice" "$0: Cannot execute $FILTER"
        exit 2
fi
$FILTER -1 -p -l66 -nH -ns
/usr/ucb/logger -p "auth.notice" "grumpy munchkins nibble nudnicks"
[ $? -ne 0 ] && exit 2
exit 0

original post:
I have an input filter for one of my printers that converts the file to
postscript and sends it to a postscript printer. It Works file with the lpr
command and doesn't work with the lp command. It gets sent to the correct
remote printer in both cases, but only gets converted to postscript with
the lpr command. Any ideas why this would happen? Shouldn't the if entry
in the /etc/printcap work the same for both lp and lpr? I am using
SunOS4.1.3.

Josh Kuperman
jkuperma@ogs.state.ny.us
(518) 473-4060



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:10:54 CDT