scriptreplay: add -T, --log-timing

Add alias to -t,--timing to make it easy to copy and past script(1)
comnand line to scriptlive(1) and scriptreplay(1) command lines.
For example:

record:
  $ script --log-timing tm --log-in in

print:
  $ scriptreplay --log-timing tm --log-in in

re-run:
  $ scriptlive --log-timing tm --log-in in

And command line is still the same.

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2019-07-30 14:59:34 +02:00
parent 37a11e1a3d
commit a33f1fc432
3 changed files with 17 additions and 5 deletions

View File

@ -69,6 +69,7 @@ usage(void)
fputs(USAGE_OPTIONS, out);
fputs(_(" -t, --timing <file> script timing log file\n"), out);
fputs(_(" -T, --log-timing <file> alias to -t\n"), out);
fputs(_(" -I, --log-in <file> script stdin log file\n"), out);
fputs(_(" -B, --log-io <file> script stdin and stdout log file\n"), out);
@ -201,6 +202,7 @@ main(int argc, char *argv[])
static const struct option longopts[] = {
{ "timing", required_argument, 0, 't' },
{ "log-timing", required_argument, 0, 'T' },
{ "log-in", required_argument, 0, 'I'},
{ "log-io", required_argument, 0, 'B'},
{ "divisor", required_argument, 0, 'd' },
@ -228,12 +230,13 @@ main(int argc, char *argv[])
replay_init_debug();
timerclear(&maxdelay);
while ((ch = getopt_long(argc, argv, "B:I:t:d:m:Vh", longopts, NULL)) != -1) {
while ((ch = getopt_long(argc, argv, "B:I:T:t:d:m:Vh", longopts, NULL)) != -1) {
err_exclusive_options(ch, longopts, excl, excl_st);
switch(ch) {
case 't':
case 'T':
log_tm = optarg;
break;
case 'I':

View File

@ -55,6 +55,11 @@ File containing \fBscript\fR's terminal output and input.
.BR \-t , " \-\-timing " \fIfile\fR
File containing \fBscript\fR's timing output. This option overrides old-style arguments.
.TP
.BR \-T , " \-\-log\-timing " \fIfile\fR
aliast to \fB\-t\fR, maintained for compatibility with
.B script (1)
command line options.
.TP
.BR \-s , " \-\-typescript " \fIfile\fR
File containing \fBscript\fR's terminal output. Deprecated alias to \fB\-\-log-out\fR.
This option overrides old-style arguments.

View File

@ -54,9 +54,11 @@ usage(void)
fputs(USAGE_OPTIONS, out);
fputs(_(" -t, --timing <file> script timing log file\n"), out);
fputs(_(" -T, --log-timing <file> aliast to -t\n"), out);
fputs(_(" -I, --log-in <file> script stdin log file\n"), out);
fputs(_(" -O, --log-out <file> script stdout log file (default)\n"), out);
fputs(_(" -B, --log-io <file> script stdin and stdout log file\n"), out);
fputs(USAGE_SEPARATOR, out);
fputs(_(" -s, --typescript <file> deprecated alist to -O\n"), out);
fputs(USAGE_SEPARATOR, out);
@ -141,9 +143,10 @@ main(int argc, char *argv[])
static const struct option longopts[] = {
{ "cr-mode", required_argument, 0, 'c' },
{ "timing", required_argument, 0, 't' },
{ "log-in", required_argument, 0, 'I'},
{ "log-out", required_argument, 0, 'O'},
{ "log-io", required_argument, 0, 'B'},
{ "log-timing", required_argument, 0, 'T' },
{ "log-in", required_argument, 0, 'I' },
{ "log-out", required_argument, 0, 'O' },
{ "log-io", required_argument, 0, 'B' },
{ "typescript", required_argument, 0, 's' },
{ "divisor", required_argument, 0, 'd' },
{ "maxdelay", required_argument, 0, 'm' },
@ -172,7 +175,7 @@ main(int argc, char *argv[])
replay_init_debug();
timerclear(&maxdelay);
while ((ch = getopt_long(argc, argv, "B:c:I:O:t:s:d:m:x:Vh", longopts, NULL)) != -1) {
while ((ch = getopt_long(argc, argv, "B:c:I:O:T:t:s:d:m:x:Vh", longopts, NULL)) != -1) {
err_exclusive_options(ch, longopts, excl, excl_st);
@ -188,6 +191,7 @@ main(int argc, char *argv[])
errx(EXIT_FAILURE, _("unsupported mode name: '%s'"), optarg);
break;
case 't':
case 'T':
log_tm = optarg;
break;
case 'O':