Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Jan 1995 12:36:54 +0100
From:      Hinrich Eilts <eilts@iwte01.dialin.rrze.uni-erlangen.de>
To:        markh@stack.urc.tue.nl
Cc:        freebsd-questions@FreeBSD.org
Subject:   Re: HP Deskjet 500 - /etc/printcap, tex, etc...
Message-ID:  <199501221136.MAA00442@odin>

next in thread | raw e-mail | index | archive | help

>Where can I find the information to install a deskjet 500 to my machine?
>I need a nice printcap entry, perhaps with some nice filters :_) and i
>wanbt to be able to print dvi files...

/etc/printcap: (/dev/lp is a symlink to /dev/lpt0)

lp|lp_ps|local line printer:\
        :lp=/dev/lp:sd=/var/spool/lpd:lf=/var/log/lpd-errs:\
        :sh:pw#80:pl#66:mx#0:\
        :if=/usr/local/lib/printer/dj-if:

/usr/local/lib/printer/dj-if:

#!/bin/sh
export PATH=/usr/bin:/bin
export IFS=' '
export SHELL=/bin/sh

tmpfile=/tmp/lp-dj$$
errfile=/tmp/lp-dj-err$$

MAILTO=admin

## filter and interpreter

PSINTERPRETER="/usr/local/bin/gs -q -sDEVICE=cdjmono -sPAPERSIZE=a4 \
               -sOutputFile=- -dNOPAUSE -"
NROFFINTERPRETER="/usr/bin/groff -t -mandoc -Tps | \
                $PSINTERPRETER"

## printer commands ###################################################

RESET="\033E"                   # printer reset
RAW="\033&k0G"                  # raw-mode (CR=CR, LF=LF, FF=FF)
NORAW="\033&k2G"                # textmode (CR=CR, LF=CR+LF, FF=CR+FF)
WRAP="\033&s0C"                 # wrapping long lines
A4="\033&l26A"                  # DIN A4
PERFSKIPMODE="\033&l0L"         # no perforation skiping
LINES="\033&l68P"               # 68 lines per page
LEFTMARGIN="\033&a7L"           # left margin 7 chars
EJECTPAGE="\033&l0H"            # paper eject

##### printing #########################################################
# printer reset
/usr/bin/printf $RESET

# copy first block of data from stdin to tempfile and determine its type
/bin/dd count=1 > $tmpfile 2>/dev/null
/bin/chmod 400 $tmpfile
typ=`/usr/bin/file $tmpfile | /usr/bin/cut -d' ' -f2-`

# filtering data
/bin/cat $tmpfile - | \
(
case $typ in
  PostScript*)          # PostScript
                    /bin/sh -c "$PSINTERPRETER" || /usr/bin/printf $EJECTPAGE
                ;;
  troff*)               # nroff
                    /bin/sh -c "$NROFFINTERPRETER" || /usr/bin/printf $EJECTPAGE
                ;;
  *text*|*script*)      # text
                    /usr/bin/printf $NORAW
                    /usr/bin/printf $WRAP
                    /usr/bin/printf $A4
                    /usr/bin/printf $PERFSKIPMODE
                    /usr/bin/printf $LINES
                    /usr/bin/printf $LEFTMARGIN
                    /bin/cat -
                ;;
  *data*)               # data
                    /usr/bin/printf $RAW
                    /bin/cat -
                ;;
                *)      # unknown
                    echo "$0: unknown type $typ > /dev/console
                    echo "$0: unknown type $typ | /usr/bin/mail $MAILTO
                    NoTyp=1
                ;;
esac
) 2> $errfile
/bin/chmod 400 $errfile

# remove tempfile, if successfully printed
if [ -z "$NoTyp" ]
then
  /bin/rm -f $tmpfile
  /bin/rm -f $errfile
fi

# reset printer
/usr/bin/printf $RESET




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199501221136.MAA00442>