From 596f42027d7e9ff7486abe90cf38e3f6cbd6f44c Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 3 Apr 2019 16:32:41 +0200 Subject: [PATCH] script: log file usage refactoring This commit does not add any new feature. It just prepare code for future extensions only. * introduce two new structs: script_stream and script_log * define two streams: 'stdout' and 'stdin' * allow associate log files (type script or timing file) with the stream * support more log file formats Signed-off-by: Karel Zak --- term-utils/script.c | 386 ++++++++++++++++++++++++++++---------------- 1 file changed, 250 insertions(+), 136 deletions(-) diff --git a/term-utils/script.c b/term-utils/script.c index c7bc1d6f2..7bf4a5e46 100644 --- a/term-utils/script.c +++ b/term-utils/script.c @@ -72,6 +72,7 @@ #include "monotonic.h" #include "timeutils.h" #include "strutils.h" +#include "xalloc.h" #include "debug.h" @@ -98,18 +99,36 @@ UL_DEBUG_DEFINE_MASKNAMES(script) = UL_DEBUG_EMPTY_MASKNAMES; #define DEFAULT_TYPESCRIPT_FILENAME "typescript" +enum { + SCRIPT_FMT_RAW = 1, /* raw slave/master data */ + SCRIPT_FMT_TIMING_SIMPLE, /* timing info in classic "