mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Added log feature
Added "--log <filename>" option which writes all activity to specified file.
This commit is contained in:
parent
d574172205
commit
bbda0b8851
9 changed files with 140 additions and 4 deletions
10
src/tty.c
10
src/tty.c
|
|
@ -35,6 +35,7 @@
|
|||
#include "gotty/print.h"
|
||||
#include "gotty/options.h"
|
||||
#include "gotty/time.h"
|
||||
#include "gotty/log.h"
|
||||
|
||||
static int connected = false;
|
||||
struct termios new_stdout, old_stdout, old_tio;
|
||||
|
|
@ -204,6 +205,11 @@ int connect_tty(void)
|
|||
/* Print received tty character to stdout */
|
||||
putchar(c_tty);
|
||||
fflush(stdout);
|
||||
|
||||
/* Write to log */
|
||||
if (option.log)
|
||||
log_write(c_tty);
|
||||
|
||||
if (c_tty != 0x7) // Small trick to avoid ctrl-g echo
|
||||
tainted = true;
|
||||
} else
|
||||
|
|
@ -229,6 +235,10 @@ int connect_tty(void)
|
|||
/* Forward input to tty device */
|
||||
status = write(fd, &c_stdin[0], 1);
|
||||
|
||||
/* Write to log */
|
||||
if (option.log)
|
||||
log_write(c_stdin[0]);
|
||||
|
||||
/* Insert output delay */
|
||||
if (option.output_delay)
|
||||
usleep(option.output_delay * 1000);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue