Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!ukma!nrl-cmf!cmcl2!rocky8!rocky2.rockefeller.edu!edf From: edf@rocky2.rockefeller.edu (David MacKenzie) Newsgroups: comp.sources.bugs Subject: improved htroff script for troff2lj Keywords: htroff troff2lj download Message-ID: <200@rocky8.rockefeller.edu> Date: 20 Sep 88 06:21:59 GMT Sender: notes@rocky8.rockefeller.edu Reply-To: edf@rocky2.rockefeller.edu (David MacKenzie) Organization: Environmental Defense Fund Lines: 135 References: Here is an improved "htroff" command that replaces the one distributed in troff2lj-v2. It solves a problem I was having, that I had to send the soft fonts I needed and the document text itself to the LaserJet as separate jobs, and often someone else's print job would get in between them and erase all of my downloaded fonts. #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh'htroff.1' <<'END_OF_FILE' X.TH HTROFF 1 X.SH NAME Xhtroff \- text formatter for HP LaserJet X.SH SYNOPSIS X.B htroff X[ X.B \-options X] [ X.B files X] X.SH DESCRIPTION X.I Htroff Xis a front end for the troff(1) text formatting program. It sends its Xoutput to a Hewlett-Packard LaserJet or compatible printer. In addition Xto all of the standard troff options, X.I htroff Xalso accepts arguments of the form X.I \-nXX, Xwhich indicate that the font with name X.I XX Xis to be mounted on font position X.I n X(1 <= X.I n X<= 3). Fonts 1-3 default to "R", "I", and "B", (Times Roman, Times XBold, and Times Italic) respectively. X.PP XAlso, arguments of the form X.I \-dfontfile Xare accepted, and cause the named X.I fontfile Xto be downloaded to the printer before the text is printed. X.SH "SEE ALSO" Xdownload(1), troff(1) X.SH AUTHORS XSverre Froyen, David MacKenzie END_OF_FILE if test 815 -ne `wc -c <'htroff.1'`; then echo shar: \"'htroff.1'\" unpacked with wrong size! fi # end of 'htroff.1' fi if test -f 'htroff' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'htroff'\" else echo shar: Extracting \"'htroff'\" \(1117 characters\) sed "s/^X//" >'htroff' <<'END_OF_FILE' X: X# htroff - troff for HP LaserJet X# Usage: htroff [-options] [files] X# X# Special options: X# -nXX mount font XX on position n (n = 1-3) X# -dYY download font YY X# X# Sends its output to the LaserJet automatically. X# Latest revision: 07/26/88 X Xtranslate=troff2lj X#translate=/usr/local/lib/troff2lj Xprintcmd='lpr -plaserjet' X#printcmd='uux -n - "sst!/usr/ucb/lpr -Prhp"' Xdownload= # null to start out with Xdfiles= X Xoptions=-t # Send output to stdout instead of /dev/cat. Xljopts= Xfiles= Xfont1=R Xfont2=I Xfont3=B X Xfor arg Xdo X case $arg in X -) files="$files $arg" ;; X -d*) download="download -d"; X dfiles="$dfiles `echo $arg|sed 's/-d//'`" ;; X -1*) font1=`echo $arg|sed 's/-1//'`; ljopts="$ljopts $arg" ;; X -2*) font2=`echo $arg|sed 's/-2//'`; ljopts="$ljopts $arg" ;; X -3*) font3=`echo $arg|sed 's/-3//'`; ljopts="$ljopts $arg" ;; X -[4-9]*|-0*) echo "Illegal font mount: $arg" >&2; exit 1 ;; X -*) options="$options $arg" ;; X *) files="$files $arg" ;; X esac Xdone X X{ X$download $dfiles X{ Xecho "\ X.fp 1 $font1 X.fp 2 $font2 X.fp 3 $font3 X.fp 4 S X.lg 0" X Xcat $files X} | troff $options | $translate $ljopts X} | $printcmd END_OF_FILE if test 1117 -ne `wc -c <'htroff'`; then echo shar: \"'htroff'\" unpacked with wrong size! fi chmod +x 'htroff' # end of 'htroff' fi echo shar: End of shell archive. exit 0 ----- David MacKenzie Environmental Defense Fund edf@rocky2.rockefeller.edu (...rutgers!cmcl2!rocky2!edf)