Article View: net.micro.mac
Article #6933Red Ryder Kermit mode problem explained w/workaround
From: Ben Cranston
Date: Mon, 25 Aug 1986 23:02
Date: Mon, 25 Aug 1986 23:02
83 lines
3705 bytes
3705 bytes
It appears that the conflict between Red Ryder's "Kermit mode" and various
mainframe Kermit programs is due to Red Ryder's implementation of only the
so-called "image mode" of Kermit, and not the "text mode".
The differance is that "image mode" transfer is strictly byte-for-byte,
while "text mode" attempts to translate the computers' various "newline"
schemes to a machine independant end-of-line representation on the wire.
The conflict comes about because Unix uses LF (Linefeed) as a NewLine
mark while the Macintosh uses CR (Carriage Return), and is complicated
by the interactions that take place when one Kermit is in text mode
and the other is in image mode.
I have tried to make this known to Scott Watson over GEnie, but as of this
writing (three weeks AFTER I sent him the check for Red Ryder) he has not
seen fit to either reply or authorize me to the Red Ryder roundtable.
Fortunately there is a work-around. Before downloading a text file from
Unix to the Macintosh, pass the file through the filter:
tr '\012' '\015'
which translates the LF codes to CR. Then, use the image mode on the
Unix version of Kermit:
% kermit -is <thing>
and the file should end up with the proper EOL codes on the Macintosh.
A similar technique can be done when uploading. Upload the file with
the image mode set on the Unix Kermit:
% kermit -ir
then pass it through the filter:
tr '\015' '\012'
to translate the CR codes to LF to make it a kosher Unix text file.
Be *SURE* to use the image mode on the Unix Kermit:
If you do not use "image mode" when uploading:
The Unix Kermit will be looking for machine-independant CR-LF pairs for
newlines, and will actually EAT the bare CR codes the Mac is sending,
and you will end up with a Unix file with no newlines at all. It is
not possible to recover from this, as the positions of the newlines will
have been lost forever.
If you do not use "image mode" when downloading:
The Unix Kermit will send CF-LF pairs for newlines, the Mac will interpret
the CR as a newline, and the LF codes will appear as square boxes at the
beginning of each line. Note that use of the "discard control characters"
option on Red Ryder will probably get rid of these boxes, but will also
get rid of any other control characters in the text.
These shell scripts embody the 'tr' calls documented above, and allow an
optional filename as argument. They have been tested on Berkeley systems.
% cat ~/bin/crnl
#! /bin/sh
# convert CR to Newlines for Red Ryder Kermit upload
# usage: crnl file or command | crnl
eval tr '\\015' '\\012' ${1+'<$1'}
% cat ~/bin/nlcr
#! /bin/sh
# convert Newlines to CR for Red Ryder Kermit download
# usage: nlcr file or command | nlcr
eval tr '\\012' '\\015' ${1+'<$1'}
Testing on SVR2, extension to multiple arguments, and other forms of the
dreaded "feeping creaturism" are left as exercises for the student...
--
umd5.UUCP <= {seismo!umcp-cs,ihnp4!rlgvax}!cvl!umd5!zben
Ben Cranston zben @ umd2.UMD.EDU Kingdom of Merryland Sperrows 1100/92
umd2.BITNET "via HASP with RSCS"
Technical Details
Message-ID:
<1197@umd5>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!umcp-cs!cvl!umd5!zbenShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!umcp-cs!cvl!umd5!zben From: zben@umd5 (Ben Cranston) Newsgroups: net.micro.mac Subject: Red Ryder Kermit mode problem explained w/workaround Message-ID: <1197@umd5> Date: Mon, 25-Aug-86 19:02:41 EDT Article-I.D.: umd5.1197 Posted: Mon Aug 25 19:02:41 1986 Date-Received: Mon, 25-Aug-86 22:03:49 EDT Organization: University of Maryland, College Park Lines: 83 Keywords: Kermit RedRyder workaround