tsp@wlcrjs.UUCP (Tom Poindexter) (06/21/85)
I needed a way to use two printers in PC-Xenix, but the "lpr" command only works with one printer. Of course I could do something like "cp file /dev/lp1 &", but I would rather use the spooler (even if it does have a few quirks). I created a "lpr2" command by hacking a copy of lpr with adb (yuck!, but it works). A separate daemon was also needed, and was hacked with the same concept. The following shell script should work. One of the annoying quirks of printing is that /usr/lib/lpd eats most control and non-ascii characters. Thus I can't send the codes to control an Epson for bold, underscore, etc. If anyone has a patch for this, please mail me a copy. I have asked IBM for a patch, and they have said "Don't call us, we'll call you". If they do come through, or if I find it, I will post it. Tom Poindexter uucp: ihnp4!wlcrjs!tsp Compuserve: 70040,1223 Source: STW526 Dialcom: 44:SFP008 # - cut here ----- this is a shell script # # # lpr2.sh - makes a "lpr2" command and "lp2" daemon to access a # second printer. # also makes a spool directory, /usr/spool/lp2, default commands, # /etc/default/lp2, and link l2 to the second printer # # adb is used to patch the text strings. if you don't have # the Software Development package, you can use "debug" under # DOS to patch: # doscp -r /usr/bin/lpr A:lpr2; doscp -r /usr/lib/lpd A:lp2 # (DOS) debug lpr # e 29f1 32 # e 2a6d 32 # e 2a7a 32 # e 2a83 32 # e 2a8c 32 # e 2a99 32 # w # q # debug lp2 # e 3a33 32 # e 3a43 32 # e 3a61 32 # e 3ac1 32 # e 3b47 32 # e 3b5d 32 # e 3c06 32 # w # q # doscp -r A:lpr2 /usr/bin/lpr2; doscp -r A:lp2 /usr/lib/lp2 # chmod 711 /usr/bin/lpr2; chmod 4711 /usr/lib/lp2 # ..and make /usr/spool/lp2, /etc/default/lp2, /dev/l2 # and chown & chgrp as in this script. # # you should be logged-in or su'ed to "root" to run this shell # execute this script with 'sh lpr2.sh' # # # change all occurances of 'pd' in lpd to 'p2' # for lpr2 command # cd /usr/bin cp lpr lpr2 adb -w lpr2 <<\EOF 71:384/w 'p2' 71:508/w 'p2' 71:521/w 'p2' 71:530/w 'p2' 71:539/w 'p2' 71:552/w 'p2' $q EOF chown bin lpr2 chgrp bin lpr2 echo '/usr/bin/lpr2 command made' # # change all occurance of {/usr/spool,/etc/default}/lpd to lp2 # and /dev/lp to /dev/l2 (see 71:517), for lp2 daemon # cd /usr/lib cp lpd lp2 adb -w lp2 <<\EOF 71:50/w 'p2' 71:66/w 'p2' 71:96/w 'p2' 71:192/w 'p2' 71:326/w 'p2' 71:348/w 'p2' 71:517/w 'l2' $q EOF chown bin lp2 chgrp bin lp2 echo '/usr/lib/lp2 daemon made' # # now make the spool directory # cd /usr/spool mkdir lp2 chmod +w lp2 chown bin lp2 chgrp bin lp2 cd lp2 cp /dev/null LOG chown bin LOG chgrp bin LOG echo '/usr/spool/lp2 directory made' # # and the default file # cd /etc/default cp lpd lp2 chown bin lp2 chgrp bin lp2 echo '/etc/default/lp2 file made (a copy of /etc/default/lpd)' # # finally, plug in the correct printer you want for lpr2 # cd /dev echo ' Shown below is the printer device to which lp (lpr command) is linked. ' find . -name 'lp?' -links 2 -print echo -n ' Now enter the printer you want to use for lpr2. Your response should be different from the device above. lp0 - the first serial/printer board lp1 - the second serial/printer board lp2 - the monochrome/printer board Your choice: ' read printer2 ln $printer2 l2 echo 'l2 linked' # cd echo 'All done.' echo 'If you already have a printer attached, send some test output to lpr2, for example "cal | lpr2".' # that's all folks!!