From 1dabf0fdf5d18bfe32503fac1f8318c39c0588bd Mon Sep 17 00:00:00 2001 From: Martin Lund Date: Fri, 17 Jun 2022 10:59:59 +0200 Subject: [PATCH] Add config support for log-strip --- man/tio.1.in | 2 ++ src/configfile.c | 21 ++++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/man/tio.1.in b/man/tio.1.in index cf72afb..6f00093 100644 --- a/man/tio.1.in +++ b/man/tio.1.in @@ -247,6 +247,8 @@ Disable automatic connect Enable log to file .IP "\fBlog-filename" Set log filename +.IP "\fBlog-strip" +Enable strip of control and escape sequences from log .IP "\fBlocal-echo" Enable local echo .IP "\fBtimestamp" diff --git a/src/configfile.c b/src/configfile.c index 617b31d..41c95bc 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -144,6 +144,22 @@ static int data_handler(void *user, const char *section, const char *name, option.log = false; } } + else if (!strcmp(name, "log-file")) + { + asprintf(&c->log_filename, "%s", value); + option.log_filename = c->log_filename; + } + else if (!strcmp(name, "log-strip")) + { + if (!strcmp(value, "enable")) + { + option.log_strip = true; + } + else if (!strcmp(value, "disable")) + { + option.log_strip = false; + } + } else if (!strcmp(name, "local-echo")) { if (!strcmp(value, "enable")) @@ -181,11 +197,6 @@ static int data_handler(void *user, const char *section, const char *name, { option.timestamp = timestamp_option_parse(value); } - else if (!strcmp(name, "log-file")) - { - asprintf(&c->log_filename, "%s", value); - option.log_filename = c->log_filename; - } else if (!strcmp(name, "map")) { asprintf(&c->map, "%s", value);