Subject: Re: attached to ansi printing on Mac

From: [email-masked] (Stan Kerr)
Date: 13 Dec 1995 16:40:57 GMT

James Cooper ([email-masked]) wrote:
: I tried asking this question on the comp.sys.mac.comm newsgroup, and got 
: some different replies, but no clear answers --  so I'll try here.

: Pine allows my mac to print email to the printer it has selected in 
: Chooser via the attached-to-ansi setting.  Very clever.  I'd like to be 
: able to print *any* unix text file to my local printer.

: Is this possible? (I'm fairly certain it is)

: Is pine sending an ansi control code to my terminal (I'm running NCSA 
: Telnet 2.6 BTW)?  Can I write a script to send that control code out 
: before any file?

Here's what the Pine technical notes say about it:

         UNIX Pine can print  to  the  standard  UNIX  line
          printers  or  to generic printers attached to ANSI
          terminals using the escape sequences to  turn  the
          printer  on  and  off.   The  user has a choice of
          three printers in the configuration.

          The first setting, attached-to-ansi, makes use  of
          escape sequences on ANSI/VT100 terminals.  It uses
          "<ESC>[5i" to begin directing all output  sent  to
          the terminal to the printer and then "<ESC>[6i" to
          return to normal.  Pine  will  send  these  escape
          sequences  if  the  printer is set to attached-to-ansi.
          This works with most  ANSI/VT100  emulators
          on  Macs and PCs such as kermit, NCSA telnet, Ver-
          saTerm Pro, and WinQVT.  Various  terminal  emula-
          tors implement the print feature differently.  For
          example, NCSA telnet requires "capfile =  PRN"  in
          the  config.tel  file.   Attached-to-ansi printing
          doesn't work at all with the telnet provided  with
          PC-NFS.

I tried the obvious, namely constructing a file that has <esc>[5i at
the beginning, and <esc>[6i at the end, and tried a simple cat command
(from Mac NCSA Telnet, in which Pine printing does work), but the only
effect was to hang my session until I did a terminal reset. So there's
some little subtlety going on there, but I haven't had time to figure it
out yet myself.

---

From: Chip Old <[email-masked]>
Date: Sat, 16 Dec 1995 19:33:24 -0500 (EST)

> some little subtlety going on there, but I haven't had time to figure it
 
Here's a shell script that will print the contents of a text file when
you're using NCSA Telnet or any terminal program that knows how to handle
VT100/ANSI printer commands.  This came to us from someone at Towson 
State University, who ported it over from a VMS system.  Works well for us.
 
Since NCSA Telnet already lets you select text from scrollback and send 
it to the printer, there's no real need for a "Printer On" command to 
deral with scrolling text.
 
#! /bin/csh
# pcprint
# by Jeff Schmitt
# Towson State University
#
# usage:
#      pcprint file.ext [,...]
#
# based on (VMS) pcprint
#$!
#$!        Terry Kennedy           Operations Manager, Academic Computing
#$!        [email-masked]     St. Peter's College, US
#$!        [email-masked]    (201) 915-9381
#$!
#$! Print VMS files on the printer that is attached to your VT102,
#$! VT200, or VT300, or PC with MS-DOS Kermit or other VT terminal
#$! emulator that supports the "transparent print" function.
#$!
#$! Author: Mark Buda
#$!
set ff     = '\014'
set esc    = '\033'
#! Remote printer "ON" sequence
#set rp_on  = $esc + "[5i"
#! Remote printer "OFF" sequence
#set rp_off = $esc + "[4i"
#
#
foreach file ($argv)
   if (-e $file) then
      #echo rp_on
      echo ''
   else
      echo "file does not exist: $file"
      exit 1
   endif
end

--------------------------------------------------------------------
Francis E. Old (Chip Old)         Internet: [email-masked]
Internetworking Administrator     Voice:    (410) 887-6180
Baltimore County Public Library   FAX:      (410) 887-2091
320 York Road
Towson, Maryland 21204 USA