ttynvt: Enable disabling telnet processing

Similar to suggestion by Jo Luxer:
"Make applications work, which expect a tty but the remote end is just a
network port."
https://gitlab.com/lars-thrane-as/ttynvt/-/merge_requests/9
This commit is contained in:
Kim Woelders
2023-02-16 16:47:24 +01:00
parent 20c393c053
commit d1f46f7dbe
3 changed files with 24 additions and 5 deletions
+6 -1
View File
@@ -44,6 +44,7 @@ static struct ttynvt_param {
unsigned int quiet;
unsigned int debug;
int logstd;
int raw; /* No telnet processing */
const char *close_delay;
/* Derived */
unsigned int close_delay_us;
@@ -467,12 +468,14 @@ static void ttynvt_open(fuse_req_t req, struct fuse_file_info *info)
tty->fds[FD_SLAVE].fd = fd;
tty->fds[FD_SLAVE].events = POLLIN;
res = telnet_open(tty->tn);
res =
telnet_open(tty->tn, ttynvt_param.raw ? TN_MODE_RAW : TN_MODE_TELNET);
if (res < 0)
{
errno = EPROTO;
goto open_err;
}
if ((res = pthread_mutex_init(&tty->tty_lock, NULL) < 0) ||
(res = pthread_mutex_init(&tty->poll_lock, NULL) < 0) ||
(res = pthread_create(&tty->ptid_poll, NULL, &_read_net, tty)))
@@ -1140,6 +1143,7 @@ static const struct fuse_opt ttynvt_opts[] = {
TTYNET_OPT("-n %s", dev_name, 0),
TTYNET_OPT("--name=%s", dev_name, 0),
TTYNET_OPT("-q", quiet, 1),
TTYNET_OPT("-r", raw, 1),
TTYNET_OPT("-s %s", close_delay, 0),
TTYNET_OPT("-S %s", server, 0),
TTYNET_OPT("--server=%s", server, 0),
@@ -1160,6 +1164,7 @@ static void print_help(void)
"\t-n name, --name=name (default: ttyNVT0)\n"
"\t\tDevice will be created in /dev/$name.\n"
"\t-q\t\tBe quiet (suppress informational messages)\n"
"\t-r\t\tDisable telnet processing\n"
"\t-s delay \t\tDelay at close in ms (use u suffix for us)\n"
"\t-S server, --server=host:port\n");
}