geof@imagen.UUCP (Geof Cooper) (08/08/87)
The problem is REALLY: How do I get RETURN to work properly both at the command level and in EMACS (or other RAW mode application, like vi, tip, etc....). At the command level (in "cooked tty" applications), the "big key" on the terminal (which is usually RETURN these days) is the one you want to type to end a command. Unix helps tty's to do this by internally mapping the '\r' character into '\n' (newline == linefeed) in the default terminal mode. When you go into a raw-mode application, it usually turns off this translation. Thus, it must "know" what key is the "big one" and let you use it. Emacs wants to see a '\r' to generate its "newline" function. So on Unix itself, it would be better to use CR-NUL and never generate newline, since the system will map CR-NUL into the local newline convention. BUT, in the generic case, you MIGHT be talking (perhaps from a Unix machine) to a machine that isn't Unix, and needs the CR-LF newline sequence. Or you might want the "big key" to generate the <<right thing>> without having to worry about it. So you DO want to generate newline in your telnet user program. The only resolution of this, in my mind, is for telnet user programs to always provide an OPTION for what mapping to use. After all, how does the telnet program know what the "big key" is, anyway! - Geof Cooper
ron@TOPAZ.RUTGERS.EDU (Ron Natalie) (08/09/87)
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