diff options
author | Elliott Hughes <enh@google.com> | 2021-04-22 19:20:42 -0700 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2021-04-24 04:50:32 -0500 |
commit | afcb643002302e02631320eebb5c8a15e375693a (patch) | |
tree | a2f1cba51e01674b324a2ab57c3b7c3c12d86b4f /kconfig/util.c | |
parent | dbd7a975ec64dc52af704970109f8c637600b088 (diff) | |
download | toybox-afcb643002302e02631320eebb5c8a15e375693a.tar.gz |
telnet: various fixes.
This got a bit out of hand. All I wanted to fix was the CR conversion to
get this part of https://tools.ietf.org/html/rfc854 right:
Therefore, the sequence "CR LF" must be treated as a single "new
line" character and used whenever their combined action is
intended; the sequence "CR NUL" must be used where a carriage
return alone is actually desired; and the CR character must be
avoided in other contexts. This rule gives assurance to systems
which must decide whether to perform a "new line" function or a
multiple-backspace that the TELNET stream contains a character
following a CR that will allow a rational decision.
But to understand the code well enough to do that, and to fix it so that
it works when IAC or CR sequences are split across multiple reads, I
ended up rewriting a lot:
* Add punctuation in help.
* Remove duplicated #include.
* Remove some unnecessary globals, enlarge the global buffers, and keep
state for correct IAC sequence processing across reads.
* Reduce code duplication and rewrite bits that made no sense.
* Handle entering/exiting raw mode more uniformly.
* Fix the prompt (the character count was wrong).
* Allow ^]^D (like BSD telnet) as well as ^]e to exit, and look less
like we crashed when doing so.
* Simplify the IAC sequence handling, but more importantly work
correctly when a sequence is split across multiple reads.
* Use more of the existing "x" functions from lib. (And remove code that
was duplicating what the "x" functions they'd just called had already
done.)
* Show "Connected to".
* Better signal handling.
I'm still not happy with TELOPT_ECHO and TELOPT_SGA in handle_wwdd(),
but don't (yet) understand them well enough to simplify them further. On
the bright side, I think TELOPT_NAWS is a lot clearer now.
It also occurs to me now I'm looking at the diff that although the IAC
output code is now better than it was, it probably still isn't pulling
its weight and might better be replaced by printf().
...but this patch has already gotten way out of hand!
Diffstat (limited to 'kconfig/util.c')
0 files changed, 0 insertions, 0 deletions