2 * tio - a simple TTY terminal I/O tool
4 * Copyright (c) 2014-2022 Martin Lund
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
32 int main(int argc, char *argv[])
36 /* Add error exit handler */
40 parse_options(argc, argv);
42 /* List available serial devices */
43 if (option.list_devices)
45 list_serial_devices();
49 /* Configure tty device */
52 /* Configure input terminal */
55 /* Configure output terminal */
58 /* Add log exit handler */
63 log_open(option.log_filename);
65 /* Enable ANSI text formatting (colors etc.) */
66 print_enable_ansi_formatting();
68 /* Print launch hints */
69 tio_printf("tio v%s", VERSION);
70 tio_printf("Press ctrl-t q to quit");
72 /* Connect to tty device */
73 if (option.no_autoconnect)
74 status = tty_connect();
77 /* Enter connect loop */
80 tty_wait_for_device();
81 status = tty_connect();