shiva@well.sf.ca.us (Kenneth Porter) (09/07/90)
Here's an excerpt from my lpd script that handles the NEC LC890 display. The host name and file name is extracted from the lpd cf file. This is run on a Sun 386i. Note the funny operatortype business with redefining showpage. If showpage is an operator, it can be stuck inline in the new showpage procedure body with no problem. If it's a procedure, it has to be exec-ed because the // operator just stuffs the procedure on the stack. Many of my utilities redefine showpage. They go through this operatortype contortion (or some variation) to allow seamless inheritance of previous showpage definitions without colliding with proc names like oldshowpage. A few warnings about the front-panel display: This is very device-dependent. Don't expect it to work on another kind of printer. The fp display does NOT use ASCII. Upper-case letters seem to work okay, but punctuation and lower-case gets displayed as some strange (possibly Japanese?) characters. I'd appreciate it if someone with more time could map out the character set. (This is why "capitalize -u" is used below.) #!/bin/sh # Extract info about file from config file SPOOLDIR=. LOCKF=$SPOOLDIR/lock CFFILE=`grep cf $LOCKF` FILENAME=`grep '^N' $CFFILE | cut -c2-` FPS1=\(`basename "$FILENAME" | sed -e "y/./ /" | capitalize -u`\) CLASS=`grep '^C' $CFFILE | cut -c2-` FPS2=\(`echo $CLASS | capitalize -u`\) # Put jobname in printer display echo "statusdict begin /jobname ($FILENAME) def end" echo "statusdict begin /jobsource $FPS2 def end" sleep 1 echo "/putjobtofp {statusdict begin $FPS1 $FPS2 setfpdisplay end} def" echo "putjobtofp" # next is so that "status-printing" gets reset to jobname after paper feed echo "/showpage dup load type /operatortype eq" echo "{ { //showpage putjobtofp } }" echo "{ { //showpage exec putjobtofp } }" echo "ifelse bind def"