[ Previous ] [ Next ] [ Index ] [ C-Kermit Home ] [ Kermit Home ]
Article: 10943 of comp.protocols.kermit.misc
From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
Newsgroups: comp.protocols.kermit.misc
Subject: Case Study #9: Printing
Date: 16 Jan 2000 23:40:08 GMT
Organization: Columbia University
C-Kermit 7.0 offers many ways to print, some of which are new. This
discussion focuses on the Unix version of C-Kermit but to some extent also
applies to Kermit 95 and MS-DOS Kermit.
Each kind of printing uses the SET PRINTER value as the destination for
material to be printed. You can see the current SET PRINTER value with SHOW
PRINTER. The default PRINTER value is "(default)", which means to use the
default system printer. The Unix version of C-Kermit lets you select
different SET PRINTER values, which can be:
- A filename, to redirect all printer output to the specified file.
Each print operation appends to the given file (or creates it if it
doesn't exist).
- A pipeline; that is, a pipe symbol followed by one or more commands,
which are to receive the material to be printed as standard input;
for example "set printer {| lpr -PLaserJet5L}". Of course the command
need not be "lpr"; it can be anything at all.
Printing methods include:
- The PRINT command, which lets you print a local file. You can
include printer options after the filename; for example in Unix
(when using "lpr"): "print oofa.txt -#3" to print 3 copies of the
oofa.txt file.
- SET DESTINATION PRINTER. This tells C-Kermit that any files
received using Kermit protocol are to be sent to the SET PRINTER device,
rather than stored on disk. (Other destinations include DISK, SCREEN,
and NOWHERE.)
- The SEND /PRINT command tells C-Kermit to send a file to the Kermit
program on the other computer and have it printed there (RPRINT and
REMOTE PRINT are synonyms for SEND /PRINT).
- The -G command-line option, new to C-Kermit 7.0, is like -g (GET)
but sends the incoming file to standard output so it can be piped into
a command such as "lpr".
- Transparent printing, new to C-Kermit 7.0, operates when C-Kermit is
in CONNECT mode.
Transparent printing is initiated by the host when it sends the escape
sequence <ESC>[5i to the terminal (when C-Kermit is in
CONNECT mode, C-Kermit is the "terminal"). All subsequent material goes to
the printer (rather than the screen) until the escape sequence
<ESC>[4i arrives, which means to stop printing.
C-Kermit 7.0 does transparent printing only if you tell it to SET TERMINAL
PRINT ON. By default, TERMINAL PRINT is OFF for compatibility with previous
releases and also because you might be accessing Unix from a real terminal
or a terminal emulator that you want to handle the transparent printing.
The SHOW TERMINAL command tells you whether PRINT is ON or OFF.
Unlike the Kermit-protocol based methods, transparent printing is NOT
error-checked; this can make a difference on serial connections that are
noisy or not well flow-controlled. Also, transparent-print material is not
converted in any way. When using the Kermit protocol methods, on the other
hand, you get error-free data transfers in your choice of text or binary
mode and, with text transfers, your choice of character-set translations.
For details about transparent printing, see
Section 3.3 of
ckermit2.txt.
Now let's try to make some sense of this jumble. When you are using
Kermit, you are usually using two computers at once: one (let's call it A)
where you have used to Kermit to make a connection to the second one (call it
B). Either Computer A or Computer B (or both) can have a printer that you want
to use. Considering these two computers:
- You can print a Computer A file on Computer A's printer.
- You can print a Computer A file on Computer B's printer.
- You can print a Computer B file on Computer A's printer.
- You can print a Computer B file on Computer B's printer.
Here is a summary of some (not necessarily all) ways to do each with Kermit:
- To print a local file from the Kermit prompt on Computer A:
- You can use Kermit's PRINT command.
- Use a "shell escape" command like "!lpr -P oofa.txt".
- In some cases you can also use the COPY command; e.g. in
Kermit 95, where the printer is accessed as a device rather
than as a command.
- To send a (local) file from Computer A to be printed on Computer B:
- You can transfer it with Kermit in the traditional manner and
then give the appropriate command to Computer B to print it.
- You can use SEND /PRINT (RPRINT, REMOTE PRINT) to transfer the
file to Computer B's Kermit program, which should send it directly
to Computer B's printer.
- If Computer B has C-Kermit 7.0, you can use:
kermit -G filename | lpr
on Computer B. This triggers an "autoupload" from
Computer A and the result is sent to Computer B's printer by piping it to
Computer B's lpr command.
- A Kerbang Script can be used on Computer B:
#!/usr/local/bin/kermit +
set destination printer
get {\%1}
exit \v(status)
- To print a Computer B (remote) file on Computer A's (local) printer:
- You can transfer it with Kermit in the traditional manner and
then give the appropriate command to Computer A to print it.
- You can tell Computer A's Kermit to SET DESTINATION PRINTER and
then send the file with Kermit from Computer B to Computer A.
- You can start Kermit on Computer B and give it a SEND /PRINT
(RPRINT, REMOTE PRINT) command. This should trigger an
autodownload
to Computer A's Kermit program, which should send the file directly
to its local printer.
- While Kermit on Computer A is in CONNECT mode, use a transparent
printing command like "pcprint" on Computer B. Remember, C-Kermit
must first have this feature enabled with SET TERMINAL PRINT ON.
- To use Computer A to cause a Computer B file to be printed on Computer B:
- With Computer A's Kermit in CONNECT mode, just give the appropriate
printing command at Computer B's prompt.
- With Computer B's Kermit program at its prompt, give it a PRINT
command for the desired file.
- With Computer B's Kermit in server mode, and Computer A's Kermit at
its prompt, give the command "remost host printcommand filename",
where printcommand is the command used for printing on Computer B,
and filename is the name of the file on Computer B to be printed.
For symmetry Kermit should also have a GET /PRINT print command; this will
be added in a future release. For now use SET DESTINATION PRINTER, GET, and
then SET DESTINATION DISK to restore the default destination in case you
will be transferring more files.
- Frank
[ Top ] [ Previous ] [ Next ] [ Index ] [ C-Kermit Home ] [ Kermit Home ]
C-Kermit 7.0 / Columbia University / kermit@columbia.edu / 16 Jan 2000