Wed 29 Jun 2016 09:06:13 AM UTC, original submission:
There are three issues in the same code chunk so I prefer to note them together.
I. InitTTY() in tty.c currently has (in master branch):
#if defined(VKILL)
#if (VKILL < MAXCC)
m->tio.c_cc[VKILL] = Ctrl('H');
#endif
All other settings look reasonable but Ctrl+H for VKILL is strongly weird because the default for the thorough Unix life is Ctrl+U.
This value is copied from pre-Git times, reasoning isn't known, so I suggest this is typo going from times of battle between two Backspace styles.
This affects terminals created in initially detached mode, with command like "screen -c $config -dm" and config lines like
screen -t proxy 0
stuff "~/utils/gasket proxy\n"
the created terminal is badly controllable.
Fix is trivial:
diff --git a/src/tty.c b/src/tty.c
index 585e0f50..d50486f7 100644
--- a/src/tty.c
+++ b/src/tty.c
@@ -272,7 +272,7 @@ void InitTTY(struct mode *m, int ttyflag)
#endif /* VERASE */
#if defined(VKILL)
#if (VKILL < MAXCC)
- m->tio.c_cc[VKILL] = Ctrl('H');
+ m->tio.c_cc[VKILL] = Ctrl('U');
#endif
#endif /* VKILL */
#if defined(VEOF)
II. Also, such terminals get VMIN=0, despite tty.c code sets TTYVMIN to 1 and then sets VMIN to TTYVMIN.
III. For some parameters, it sets values to 0 in context where they supposed to be disabled:
#if defined(VEOL)
#if (VEOL < MAXCC)
m->tio.c_cc[VEOL] = 0000;
#endif
the same for VEOL2, VSWTCH. But, 0 is "disable" at Linux and some other flavors, but not BSD group.
Suggested fix:
diff --git a/src/tty.c b/src/tty.c
index 585e0f50..48af30a6 100644
--- a/src/tty.c
+++ b/src/tty.c
@@ -47,6 +47,10 @@
#include "telnet.h"
#include "tty.h"
+#ifndef _POSIX_VDISABLE
+#define _POSIX_VDISABLE 0000
+#endif
+
static void consredir_readev_fn(Event , void );
bool separate_sids = true;
@@ -282,17 +286,17 @@ void InitTTY(struct mode *m, int ttyflag)
#endif /* VEOF */
#if defined(VEOL)
#if (VEOL < MAXCC)
- m->tio.c_cc[VEOL] = 0000;
+ m->tio.c_cc[VEOL] = _POSIX_VDISABLE;
#endif
#endif /* VEOL */
#if defined(VEOL2)
#if (VEOL2 < MAXCC)
- m->tio.c_cc[VEOL2] = 0000;
+ m->tio.c_cc[VEOL2] = _POSIX_VDISABLE;
#endif
#endif /* VEOL2 */
#if defined(VSWTCH)
#if (VSWTCH < MAXCC)
- m->tio.c_cc[VSWTCH] = 0000;
+ m->tio.c_cc[VSWTCH] = _POSIX_VDISABLE;
#endif
#endif /* VSWTCH */
#if defined(VSTART)
|