• Aucun résultat trouvé

Adding a local printer

Dans le document Operating System (Page 187-190)

The operating system also supports the use of local printers attached to the AUX or PRINT port on the back of many serial terminals. These printers are connected via standard RS-232 connections and can significantly reduce the load on shared system resources. The Iprint( C) command is used to print files on a local printer, but the terminal must be properly configured for the com-mand to work. To add a printer connected to the AUX or PRINT port on the back of a terminal and use it for local printing, follow this procedure:

1. Connect your local serial printer to the AUX port on your terminal with a standard RS-232 cable with pins 2, 3, and 7 (minimum) connected. Make sure the printer is powered on and is online. (If the terminal supports pass-through mode to the parallel port, a parallel port may be used.)

2. Log in to the UNIX system on the terminal and verify that the terminal is working correctly.

3. Make sure that the AUX port on your terminal is configured with the same settings as your printer (baud rate, parity, data bits, xon/xoff, and so forth).

4. For the lprint command to work, lprint needs to know how to start and stop local printing for each specific terminal. Iprint looks in the file /etc/termcap to find two terminal attributes: PN (start printing) and PS (stop printing). These are escape sequences that must be sent to the terminal to control local printing. Very few terminals have these attributes defined in their termcap entries. Use a text editor (such as vi(C» to examine the /etc/termcap file. (/etc/termcap can also be an alternate file, as defined by the TERMCAP variable.) Search for the entry for your terminal. For example, if your terminal is a Wyse 60, you would search for "wyse60".

The termcap entry for the Wyse 60 appears in Example 7-1.

Example 7·1 Wyse 60 termcap entry

w71wy60lwyse60lWyse WY-60 with 80 column/24 line screen in wy60 mode:\

:is=\E'\072\Ee(\EO\Ee6\Ec41\E-4\Ec21\Ed/:\

:if=/usr/lib/tabset/std:pt:\

:Gl=\EH3:G2=\EH2:G3=\EHl:G4=\EH5:GD=\EHO:GG#0:GH=\EH\072:\

:GU=\EH=:GV=\EH6:GR=\EH4:GL=\EH9:GC=\EH8:GF=\EH7:\

:PU=\EJ:PD=\EK:\

Adding a local printer

The Wyse 60 has PN and PS defined. With other terminals, you must add a line containing these two attributes to the /etc/termcap entry for your ter-minal. The line you add has the form:

: PN=start sequence:P S=stop sequence:

5. Refer to your terminal manual to find the sequence of control characters used to switch the auxiliary port on and off. This is sometimes referred to as "passthrough" or "transparent" mode. For an example of the sequence to enable auxiliary printing, the code to switch the port on for a Wyse 60 terminal is:

(Esc) d #

And the code to turn it off again is:

(CtrI)t

6. These keystrokes must be translated into termcap format before inserting them into the termcap file. termcap uses the codes in Table 7.6 to represent keystrokes.

Table 7·6 termcap keystroke translations

Keystroke

For example, (CtrI)x would be represented by AX. In addition, characters can be represented by their octal codes (see ascii(M», and the caret and backslash characters represented by \ A and \ \, respectively. Entries for termcap attributes must be separated by a colon" : ". (See termcap(M) for more details.)

Recall that the termcap attributes for starting and ending printing are PN and PS. Using the table above the termcap entry for the Wyse 60 key-strokes (Esc) d # (start printing, PN) and (CtrI)t (stop printing, PS) looks like this:

:PN=\Ed#:PS="T:\

7. For a terminal missing these entries, you simply insert a modified version of the above line into the termcap entry for the terminal. (You must be cer-tain to insert the line within the entry for your terminal; do not add it as the first line or the last line.) For other terminals, check your owner's man-ual and locate the proper sequences for turning the auxiliary print mode on and off and substitute the termcap sequences as in the example. Some terminals (such as the Wyse 60) include a "transparent" mode, where the data is not displayed on the screen as it is printed. (This is the mode selected by the PN sequence in the example.)

NOTE You must be logged in as root to edit /ete/tenneap. We recommend that you copy the original file to another name in case you make an error. You can also extract the file again from your distribution using custom(ADM).

8. Once you have added the PN and PS entries, log out and back in again to activate the new termeap entry.

9. Use the following command to print the file filename on your local printer:

lprint filename

Do not touch your keyboard while local printing is taking place; you can-not perform other tasks on your terminal while printing.

10. If your file is printed on the screen instead of the printer, the PS and PN entries you created are incorrect. Revise the entries with the correct codes.

If the file still does not print on the printer or the terminal, try crossing the Transmit and Receive Data pins in the cable connecting the terminal AUX port and the printer. (This is also known as a "null modem" connection.)

I

NOTE You can eliminate carriage return delays by setting the environ-ment variable CRDELAY to N. This should be done only if you are run-ning a fast printer.

11. If, when printing with Iprint, everything prints on one line, you should set the environment variable FORMS to X. In the Bourne shell (sh), use:

FORMS=Xi export FORMS In the C shell (csh), use:

setenv FORMS X

Dans le document Operating System (Page 187-190)

Documents relatifs