diff --git a/src/options.c b/src/options.c index a460ab7..f538f42 100644 --- a/src/options.c +++ b/src/options.c @@ -118,6 +118,7 @@ struct option_t option = .exclude_drivers = NULL, .exclude_tids = NULL, .hex_n_value = 0, + .vt100 = false, }; void print_help(char *argv[]) @@ -487,6 +488,13 @@ void options_parse(int argc, char *argv[]) option.color = -1; } + // Check for vt100 terminal + char *term = getenv("TERM"); + if ((term != NULL) && (!strcmp(term, "vt100"))) + { + option.vt100 = true; + } + while (1) { static struct option long_options[] = diff --git a/src/options.h b/src/options.h index d5a054b..016978d 100644 --- a/src/options.h +++ b/src/options.h @@ -95,6 +95,7 @@ struct option_t const char *exclude_drivers; const char *exclude_tids; int hex_n_value; + bool vt100; }; extern struct option_t option; diff --git a/src/tty.c b/src/tty.c index 6be7581..ccbb44d 100644 --- a/src/tty.c +++ b/src/tty.c @@ -1067,6 +1067,14 @@ void stdin_configure(void) void stdout_restore(void) { tcsetattr(STDOUT_FILENO, TCSANOW, &stdout_old); + + // If terminal is vt100 + if (option.vt100) + { + // Disable DEC Special Graphics character set just in case it was randomly + // enabled by noise from serial device. + putchar('\017'); + } } void stdout_configure(void)