From owner-freebsd-questions Wed Aug 9 08:51:21 1995 Return-Path: questions-owner Received: (from majordom@localhost) by freefall.FreeBSD.org (8.6.11/8.6.6) id IAA18837 for questions-outgoing; Wed, 9 Aug 1995 08:51:21 -0700 Received: from wotan.compaq.com (wotan.compaq.com [131.168.249.254]) by freefall.FreeBSD.org (8.6.11/8.6.6) with SMTP id IAA18831 for ; Wed, 9 Aug 1995 08:51:17 -0700 Received: from twisto by wotan.compaq.com with uucp (Smail3.1.28.1 #12) id m0sgDJP-0009r0C; Wed, 9 Aug 95 10:44 CDT Received: from yoda.eng.hou.compaq.com by twisto.eng.hou.compaq.com with smtp (Smail3.1.28.1 #10) id m0sgDJG-000uMrC; Wed, 9 Aug 95 10:44 CDT Received: by yoda.eng.hou.compaq.com (Smail3.1.26.7/COMPAQ-HESIOD) id m0sgDJF-0004rpC; Wed, 9 Aug 95 10:44 CDT Message-Id: From: hykel@yoda.eng.hou.compaq.com (Richard Hykel) Subject: printcap filter and lpr To: freebsd-questions@freebsd.org Date: Wed, 9 Aug 95 10:44:45 CDT X-Mailer: ELM [version 2.4dev PL11] Sender: questions-owner@freebsd.org Precedence: bulk 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.