mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Cleanup list devices code
This commit is contained in:
parent
a0d4be068b
commit
bf749aead4
3 changed files with 3 additions and 15 deletions
|
|
@ -51,13 +51,6 @@ int main(int argc, char *argv[])
|
||||||
/* Parse command-line options (2nd pass) */
|
/* Parse command-line options (2nd pass) */
|
||||||
options_parse_final(argc, argv);
|
options_parse_final(argc, argv);
|
||||||
|
|
||||||
/* List available serial devices */
|
|
||||||
if (option.list_devices)
|
|
||||||
{
|
|
||||||
list_serial_devices();
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Configure tty device */
|
/* Configure tty device */
|
||||||
tty_configure();
|
tty_configure();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "print.h"
|
#include "print.h"
|
||||||
|
#include "tty.h"
|
||||||
|
|
||||||
enum opt_t
|
enum opt_t
|
||||||
{
|
{
|
||||||
|
|
@ -56,7 +57,6 @@ struct option_t option =
|
||||||
.log = false,
|
.log = false,
|
||||||
.local_echo = false,
|
.local_echo = false,
|
||||||
.timestamp = TIMESTAMP_NONE,
|
.timestamp = TIMESTAMP_NONE,
|
||||||
.list_devices = false,
|
|
||||||
.log_filename = NULL,
|
.log_filename = NULL,
|
||||||
.socket = NULL,
|
.socket = NULL,
|
||||||
.map = "",
|
.map = "",
|
||||||
|
|
@ -264,7 +264,8 @@ void options_parse(int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'L':
|
case 'L':
|
||||||
option.list_devices = true;
|
list_serial_devices();
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'l':
|
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 */
|
/* Assume first non-option is the tty device name */
|
||||||
if (strcmp(option.tty_device, ""))
|
if (strcmp(option.tty_device, ""))
|
||||||
optind++;
|
optind++;
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,6 @@ struct option_t
|
||||||
bool log;
|
bool log;
|
||||||
bool local_echo;
|
bool local_echo;
|
||||||
enum timestamp_t timestamp;
|
enum timestamp_t timestamp;
|
||||||
bool list_devices;
|
|
||||||
const char *log_filename;
|
const char *log_filename;
|
||||||
const char *map;
|
const char *map;
|
||||||
const char *socket;
|
const char *socket;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue