This mostly is intended to have local echo output exactly what is sent
to the remote endpoint.
A nice side-effect is, that it also fixes tty-implementations, that can't
deal with the OCRNL flag on tio.c_oflag.
Logfiles are important to see what happend, in particular if something
unexpected happened; so we want to make sure that the logfile is flushed
to disk.
Before this change, the logfile was typically written at the end in
a large chunk as the default (large) buffering applied. Now, characters are
written out ASAP, so it is possible to get a live-view with a
tail -f <logfile>
The following new mapping flags are added:
INLCRNL: Map NL to CR-NL on input.
ODELBS: Map DEL to BS on output.
Flags requested and tested by Jan Ciger (janoc).
Support for non-standard baudrate settings will be automatically enabled
if the termios2 interface is detected available. However, to play it
safe, the old and widely supported termios interface will still be used
when setting standard baudrates.
Add a --map option which allows to map special characters, in particular CR and
NL characters which are used in various combinations on varios platforms.
On Fedora 26 tio will quit with the following error message:
"Error: Could not apply new stdout settings (Invalid argument)"
In case of Fedora, it turns out that the new stdout settings used are a
bit too agressive because an empty termios structure is used. To remedy
this we reuse the existing stdout settings and only reconfigure the
specific options we need to make a "raw" stdout configuration.