lpansi(1)

lpansi

SYNOPSIS

lpansi [options] [file-list]

DESCRIPTION

The Problem
UNIX supplies a printing program called lp <filename> which allows the user to print a text (or any really) file to a printer. Unfortunately, that printer is attached to the UNIX server which is not where the user usually is. In my case, it is about 230 miles away. I needed a similar program that would allow me to print to my home printer.

The solution:
The VT100 standard defines a printer on and off escape sequence. [FYI: esc[5i is printer on, esc[4i is printer off.] Lpansi is a VERY simple program that issues a printer on sequence, opens the files sent as an argument, reads it character by character, echos it to stdout (now your local printer) and ends by sending a form feed and printer off command.

Usage:
I had several purposes in mind when I wrote this. The first was to find a way to replace lp in a gopher client I had with something that would print at home. I also wanted to be able to print text files to my home printer directly from the UNIX prompt. A natural extension of this is to add it to LYNX, and other printing clients as your printer command.

Syntax:
This program accepts miltiple filenames as an argument. If no filename is present, lpansi will use standard input.

Thanks:
Thanks go to Michael Seibel on the PINE development team for helping me find the correct ANSI codes to turn off the printer. I found out later that PINE distributes a similar program called ansiprt which is supposed to do the same thing. Here, the source code is provided so you may incorporate the concept directly in your program.

Options:
    -f Form feed off, no form feed at end of each file
    -v Verbose, prints helpful information for debugging purposes.

Disclaimer:
[Everyone has one so...] I make no promises whatsoever about how this will work for you. If you have VT100 and/or ANSI, it should work just fine. If it doesn't, quit using it. :) This program is free to use and modify, but try to keep my name with it. I don't do that much cool stuff, so I need all the credit I can get. Thanks.

AUTHOR
Written by Gary Day (gday@comp.uark.edu)

MODIFICATIONS
Version 1.1 Modified by Noel Hunter (noel@wfu.edu) Version 2.0 Modified by Noel Hunter (noel@wfu.edu) Version 2.1 Modified by Noel Hunter (noel@wfu.edu)

FILES
/usr/local/bin/lpansi

SEE ALSO
lp, lynx, pine

EXAMPLES
lpansi .profile Will print the file named .profile to a printer attached to your terminal. NCSA Telnet, WRC Reflections for PC, and Kermit are known to work. In pine, use lpansi by typing "m" for "Main Menu", then selecting "s" for setup. Next, enter "p" for "Printer", and select "1. Printer attached to IBM PC or compatible, Macintosh". From then on, when you choose print in pine, it will be sent to your terminal program and attached printer.