Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Aug 95 10:44:45 CDT
From:      hykel@yoda.eng.hou.compaq.com (Richard Hykel)
To:        freebsd-questions@freebsd.org
Subject:   printcap filter and lpr
Message-ID:  <m0sgDJF-0004rpC@yoda.eng.hou.compaq.com>

next in thread | raw e-mail | index | archive | help
Someone requested printcap and filters a week or two ago.
Back when I was first bringing up 386BSD on my home
system, I occasionally wanted to print man pages.

I based my filter (sed script) upon what I could find
when I piped man pages to a file.  I did this
because I found nothing in all my O'Reilly books or 
on the system that sufficiently defined the troff 
format for me.  If the filter is still lacking
something, please let me know what it is and I
will try to add/change it.

Since I had not printed a man page in a long time,
I verified it last night on my 2.0.5 Release (CD) system:

    man lpd | lpr -t
produced a nice hard copy, bold fonts and underline 
worked well which make the printout easier to read.

This filter is for my Panasonic KXP4410 printer which 
is supposed to be HPLJ IIP compatible.

For the person (people) having trouble with their printcap
file and Postscript printer, this is probably not the
problem but just FYI:  Any time that I have changed my
printcap file, I have had to kill the running lpd daemon
and restart it manually (alternately, shutting down and
rebooting will work also) to have the changes recognized.

------------------------ printcap ------------------------------
# @(#)printcap	5.3 (Berkeley) 6/30/90
# Richard Hykel
# 7/13/93
#


lp|local line printer:\
	:lp=/dev/lpt0:sd=/var/spool/lpd:lf=/var/log/lpd-errs:sh:\
	:if=/usr/local/filters/if_ljet2:\
	:tf=/usr/local/filters/tf_ljet2:

------------------------ if_ljet2 ------------------------------
#!/bin/sh
printf "\033E\033&k2G"
cat -
printf "\033E"


------------------------ tf_ljet2 ------------------------------
#!/bin/sh
# Richard Hykel
# 7/13/93
# filter troff man page for Panasonic laser printer
# KXP-4410  ( HPLJ IIP compatible ).
#
# sed command descriptions
# line 1  - temporarily convert Underline Backspace to a (Hopefully)
#             unique sequence
# line 2  - remove the overstrike char after all backspaces (this
#             creates bold type on impact printers).
# line 3  - change two NON-backspace characters followed by a backspace
#             to    Character  BEGIN_BOLD_FONT  Character.
# line 4  - change a NON-backspace character at the beginning of a line
#             followed by a backspace to    BEGIN_BOLD_FONT Character.
# line 5  - change a backspace character followed by two NON-backspace
#             characters to   END_BOLD_FONT  Character.
# line 6  - change a backspace character followed by a NON-backspace
#             character at the end of a line to   END_BOLD_FONT  Character.
# line 7  - now replace all backspace characters at end of any line 
#             with END_BOLD_FONT.
# line 8  - remove all remaining backspace characters.
# line 9  - convert the temporary unique sequence created in line 1 back
#             to an   Underline Backspace
#
printf "\033E\033&k2G"

cat - | sed "
s/_/	!~^!!^	/g
s/.//g
s/\([^]\)\([^]\)/\1(s3B\2/g
s/^\([^]\)/(s3B\1/g
s/\([^][^]\)/(s0B\1/g
s/\([^]\)$/(s0B\1/g
s/$/(s0B/g
s///g
s/	!~^!!^	/_/g"

printf "\033E"


-- 
Richard Hykel                       hykel@twisto.compaq.com
My opinion is my own and subject to change.



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