From bf749aead4ce11c808b04c0360dc46037b0269dd Mon Sep 17 00:00:00 2001 From: Martin Lund Date: Sat, 11 Jun 2022 23:14:18 +0200 Subject: [PATCH] Cleanup list devices code --- src/main.c | 7 ------- src/options.c | 10 +++------- src/options.h | 1 - 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/main.c b/src/main.c index 2791104..2c45497 100644 --- a/src/main.c +++ b/src/main.c @@ -51,13 +51,6 @@ int main(int argc, char *argv[]) /* Parse command-line options (2nd pass) */ options_parse_final(argc, argv); - /* List available serial devices */ - if (option.list_devices) - { - list_serial_devices(); - return status; - } - /* Configure tty device */ tty_configure(); diff --git a/src/options.c b/src/options.c index 77dd6a6..cb94e81 100644 --- a/src/options.c +++ b/src/options.c @@ -34,6 +34,7 @@ #include "error.h" #include "misc.h" #include "print.h" +#include "tty.h" enum opt_t { @@ -56,7 +57,6 @@ struct option_t option = .log = false, .local_echo = false, .timestamp = TIMESTAMP_NONE, - .list_devices = false, .log_filename = NULL, .socket = NULL, .map = "", @@ -264,7 +264,8 @@ void options_parse(int argc, char *argv[]) break; case 'L': - option.list_devices = true; + list_serial_devices(); + exit(EXIT_SUCCESS); break; case 'l': @@ -338,11 +339,6 @@ void options_parse(int argc, char *argv[]) } } - if (option.list_devices) - { - return; - } - /* Assume first non-option is the tty device name */ if (strcmp(option.tty_device, "")) optind++; diff --git a/src/options.h b/src/options.h index 313e2a2..e9942de 100644 --- a/src/options.h +++ b/src/options.h @@ -51,7 +51,6 @@ struct option_t bool log; bool local_echo; enum timestamp_t timestamp; - bool list_devices; const char *log_filename; const char *map; const char *socket;