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
11
src/main.c
11
src/main.c
|
|
@ -23,6 +23,7 @@
|
|||
#include <stdlib.h>
|
||||
#include "gotty/options.h"
|
||||
#include "gotty/tty.h"
|
||||
#include "gotty/log.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
|
@ -34,9 +35,16 @@ int main(int argc, char *argv[])
|
|||
/* Configure output terminal */
|
||||
configure_stdout();
|
||||
|
||||
/* Install log exit handler */
|
||||
atexit(&log_exit);
|
||||
|
||||
/* Restore output terminal on exit */
|
||||
atexit(&restore_stdout);
|
||||
|
||||
/* Create log file */
|
||||
if (option.log)
|
||||
log_open(option.log_filename);
|
||||
|
||||
/* Connect to tty device */
|
||||
if (option.no_autoconnect)
|
||||
status = connect_tty();
|
||||
|
|
@ -50,5 +58,8 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
/* Close log */
|
||||
log_close();
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue