Printing with Linux

Tucker Balch tucker at cc.gatech.edu
Fri Oct 14 19:54:14 EDT 1994


>From the printing HOWTO:


Un*x terminates each line of a file with a linefeed but not a
carriage return so taken literally a Un*x text file printed on an ASCII
device will start each line below the end of the previous line.  Some
printers can be set to treat "linefeed" as "carriage return, linefeed",
others can't. If yours can then do simply do that. If the printer
cannot be fixed create a shell script filter that reads:
 
#!/bin/sh
if [ "$1" = -c ]; then
	cat
else
	sed -e s/$/^M/
fi 
# the ``echo -ne'' assumes that /bin/sh is really bash
echo -ne \\f

Where `^M' is a carriage return character not a `^' followed by a
`M'.  To type `^M' in Emacs use the sequence `C-q C-m' and in vi use
`C-v C-m'.  Conventionally this script is called `/usr/lib/lpf'. If you
have more than one such script a better idea is to keep them in a
subdirectory, say `/usr/lib/lpd/'. The test of `$1' allows the
insertion of carriage returns to be switched off by `lpr -l'.


--Tucker






More information about the Ale mailing list