Re: Telnet CRLF's


Ron Natalie (ron@topaz.rutgers.edu)
Sun, 9 Aug 87 15:11:59 EDT


I think the issue is getting a little confused here between what
is in the SPEC, what UNIX wants to do, and how UNIX accomplishes
it's goal.

THE SPEC:
    The image of a terminal is something with a big RETURN, ENTER, or
<--|, (I cant draw this) key. The latter label is perhaps the most
descriptive showing both the down and return indicating a new line.
If you just want a down motion, then press the LINE FEED. If for some
reason you want to return without new lining (<-<-- key) then send CR-NUL.

So the terminal should

    RETURN (down and left) send CR-LF
    LF (down) send LF
    <-<--- key or perhaps an escaped (quoted) RETURN (^Q^M for EMACS users)
            send CR-NUL.

on receipt, the exact same semantics should apply.

UNIX:
    The UNIX internal model is that LF is the end of line. CR is just
    a character and there is no explicit way to do other positioning.
    Since about the only terminal that works this way is the Model 37
    teletype, there is a compatibility feature, referred to as CRMOD
    or -nl mode. This maps CR to NL on input and NL to CRLF on output.

THE PROBLEM:
    The reason UNIX gets really confusing in TELNET is that CRMOD can
    not be turned off in only one direction, so anyone who wants to
    buypass the output mapping to do finer positioning must suddenly
    start doing the processing for CR as end-of-line in their user
    code.

So the question is should the translation go

TERMINAL (CR) -> NVT (CR-LF) -> UNIX (LF) for line termination

we can emulate what UNIX thinks a terminal ought to me (like a Model 37)

or

TERMINAL (CR) -> NVT (CR-LF) -> Real World Virtual Terminal (CR) -> UNIX (LF)

for line termination. The answer is probably the latter. NVTs and the rest
of the world look a whole lot more like the VT100s than Model 37s. Hence,
the UNIX telnet server should try to map the NVT back into the CR terminated
world before passing it to the UNIX tty driver. UNIX programs violate the
LF termination rule all the time to do things such as line editing and such
because they know that there just aren't that many Model 37s left in operation.
To avoid surprises the NVT->UNIX transformation ought to make the incoming
TELNET look like that rather than attempting to map directly from NVT to
UNIX tty conventions.

-Ron



This archive was generated by hypermail 2.0b3 on Thu Mar 09 2000 - 14:38:49 GMT