pull/912/head
Karel Zak 3 years ago
commit 3d3280ef15
  1. 8
      bash-completion/script
  2. 5
      bash-completion/scriptlive
  3. 8
      bash-completion/scriptreplay
  4. 8
      term-utils/script-playutils.c
  5. 50
      term-utils/script.1
  6. 4
      term-utils/script.c
  7. 26
      term-utils/scriptreplay.1
  8. 2
      term-utils/scriptreplay.c

@ -10,10 +10,18 @@ _script_module()
COMPREPLY=( $(compgen -c -- $cur) )
return 0
;;
'-E'|'--echo')
COMPREPLY=( $(compgen -W "auto always never" -- $cur) )
return 0
;;
'-o'|'--output-limit')
COMPREPLY=( $(compgen -W "size" -- $cur) )
return 0
;;
'-m'|'--logging-format')
COMPREPLY=( $(compgen -W "classic advanced" -- $cur) )
return 0
;;
'-h'|'--help'|'-V'|'--version')
return 0
;;

@ -5,6 +5,11 @@ _scriptlive_module()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'-c'|'--command')
compopt -o bashdefault
COMPREPLY=( $(compgen -c -- $cur) )
return 0
;;
'-d'|'--divisor'|'-m'|'--maxdelay')
COMPREPLY=( $(compgen -W "digit" -- $cur) )
return 0

@ -5,10 +5,18 @@ _scriptreplay_module()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'-c'|'--cr-mode')
COMPREPLY=( $(compgen -W "auto never always" -- $cur) )
return 0
;;
'-d'|'--divisor'|'-m'|'--maxdelay')
COMPREPLY=( $(compgen -W "digit" -- $cur) )
return 0
;;
'-x'|'--stream')
COMPREPLY=( $(compgen -W "out in signal info" -- $cur) )
return 0
;;
'-h'|'--help'|'-V'|'--version')
return 0
;;

@ -25,7 +25,7 @@ UL_DEBUG_DEFINE_MASKNAMES(scriptreplay) = UL_DEBUG_EMPTY_MASKNAMES;
/*
* The script replay is driven by timing file where each entry describes one
* step in the replay. The timing step may refer input or output (or
* signal, extra informations, etc.)
* signal, extra information, etc.)
*
* The step data are stored in log files, the right log file for the step is
* selected from replay_setup.
@ -502,13 +502,13 @@ int replay_emit_step_data(struct replay_setup *stp, struct replay_step *step, in
assert(step->name);
assert(step->value);
dprintf(fd, "%s %s\n", step->name, step->value);
DBG(LOG, ul_debug("log signal emited"));
DBG(LOG, ul_debug("log signal emitted"));
return 0;
case 'H':
assert(step->name);
assert(step->value);
dprintf(fd, "%10s: %s\n", step->name, step->value);
DBG(LOG, ul_debug("log header emited"));
DBG(LOG, ul_debug("log header emitted"));
return 0;
default:
break; /* continue with real data */
@ -565,6 +565,6 @@ int replay_emit_step_data(struct replay_setup *stp, struct replay_step *step, in
if (ct && feof(step->data->fp))
rc = 1;
DBG(LOG, ul_debug("log data emited [rc=%d size=%zu]", rc, step->size));
DBG(LOG, ul_debug("log data emitted [rc=%d size=%zu]", rc, step->size));
return rc;
}

@ -31,7 +31,7 @@
.\"
.\" @(#)script.1 6.5 (Berkeley) 7/27/91
.\"
.TH SCRIPT "1" "June 2014" "util-linux" "User Commands"
.TH SCRIPT "1" "October 2019" "util-linux" "User Commands"
.SH NAME
script \- make typescript of terminal session
.SH SYNOPSIS
@ -51,7 +51,7 @@ Since version 2.35
.B script
supports multiple streams and allows to log input and output to separate
files or all the one file. This version also supports new timing file
which records additional information. The command
which records additional information. The command
.B scriptreplay \-\-summary
then provides all the information.
@ -89,11 +89,19 @@ the output of a program that behaves differently when its stdout is not a
tty.
.TP
\fB\-E\fR, \fB\-\-echo\fR \fIwhen\fR
This option controls the ECHO flag for pseudoterminal within the session. The
supported modes are always, never, or auto. The default is "auto" -- in this
case, ECHO is disabled if the current standard input is a terminal to avoid
double-echo, and enabled if standard input is not terminal (for example pipe:
"echo date | script") to avoid missing input in the session log.
This option controls the ECHO flag for pseudoterminal within the session. The
supported modes are
.IR always ,
.IR never ,
or
.IR auto .
The default is
.I auto
-- in this case, ECHO is disabled if the current standard input is a
terminal to avoid double-echo, and enabled if standard input is not terminal
(for example pipe:
.BR "echo date | script" )
to avoid missing input in the session log.
.TP
\fB\-e\fR, \fB\-\-return\fR
Return the exit code of the child process. Uses the same format as bash
@ -107,8 +115,9 @@ being done using `cat foo'. Note that flush has an impact on performance, it's
possible to use SIGUSR1 to flush logs on demand.
.TP
\fB\-\-force\fR
Allow the default output destination, i.e. the typescript file, to be a hard
or symbolic link. The command will follow a symbolic link.
Allow the default output file
.B typescript
to be a hard or symbolic link. The command will follow a symbolic link.
.TP
\fB\-B\fR, \fB\-\-log\-io\fR \fIfile\fR
Log input and output to the same
@ -121,24 +130,29 @@ Log input to the \fIfile\fR. The log output is disabled if only \fB\-\-log\-in\
specified.
.sp
Use this logging functionality carefully as it logs all input, including input
when terminal has disabled echo flag (for example it log passwords in the input).
when terminal has disabled echo flag (for example password inputs).
.TP
\fB\-O\fR, \fB\-\-log\-out\fR \fIfile\fR
Log output to the \fIfile\fR. The default is to log output to the file with
name 'typescript' if the option \fB\-\-log\-out\fR or \fB\-\-log\-in\fR is not
given. The log output is disabled if only \fB\-\-log\-in\fR specified.
Log output to the \fIfile\fR. The default is to log output to the file with
name
.B typescript
if the option \fB\-\-log\-out\fR or \fB\-\-log\-in\fR is not given. The log
output is disabled if only \fB\-\-log\-in\fR specified.
.TP
\fB\-T\fR, \fB\-\-log\-timing\fR \fIfile\fR
Log timing information to the \fIfile\fR. Two timing file formats are supporte
Log timing information to the \fIfile\fR. Two timing file formats are supported
now. The classic format is used when only one stream (input or output) logging
is enabled. The multi-stream format is used on \fB\-\-log\-io\fR or when
is enabled. The multi-stream format is used on \fB\-\-log\-io\fR or when
\fB\-\-log\-in\fR and \fB\-\-log\-out\fR are used together.
See also \fB\-\-logging\-format\fR.
.TP
\fB\-m\fR, \fB\-\-logging\-format\fR \fIformat\fR
Force use 'advanced' or 'classic' format. The default is the classic format to
log only output and the advanced format when input as well as output logging is
requested.
Force use
.I advanced
or
.I classic
format. The default is the classic format to log only output and the
advanced format when input as well as output logging is requested.
.sp
.RS
.B Classic format

@ -94,7 +94,7 @@ UL_DEBUG_DEFINE_MASKNAMES(script) = UL_DEBUG_EMPTY_MASKNAMES;
* types of log files: "timing file" (simple or multistream) and "data file"
* (raw).
*
* The same log file maybe be shared between both streams. For exmaple
* The same log file maybe be shared between both streams. For example
* multi-stream timing file is possible to use for stdin as well as for stdout.
*/
enum {
@ -800,7 +800,7 @@ int main(int argc, char **argv)
/* The default is to keep ECHO flag when stdin is not terminal. We need
* it to make stdin (in case of "echo foo | script") log-able and
* visiable on terminal, and for backward compatibility.
* visible on terminal, and for backward compatibility.
*/
ctl.isterm = isatty(STDIN_FILENO);
echo = ctl.isterm ? 0 : 1;

@ -1,4 +1,4 @@
.TH SCRIPTREPLAY 1 "September 2011" "util-linux" "User Commands"
.TH SCRIPTREPLAY 1 "October 2019" "util-linux" "User Commands"
.SH "NAME"
scriptreplay \- play back typescripts, using timing information
.SH "SYNOPSIS"
@ -66,9 +66,13 @@ This option overrides old-style arguments.
.TP
.BR \-c , " \-\-cr\-mode " \fImode\fR
Specifies how to use CR (0x0D, carriage return) character from log files.
The default mode is "auto", in this case CR is replaced with line break for
stdin log, because otherwise scriptreplay will overwrite the same line.
The another modes are "never" and "always".
The default mode is
.IR auto ,
in this case CR is replaced with line break for stdin log, because otherwise
scriptreplay will overwrite the same line. The another modes are
.I never
and
.IR always .
.TP
.BR \-d , " \-\-divisor " \fInumber\fR
Speed up the replay displaying this
@ -84,13 +88,21 @@ avoid long pauses in the transcript replay.
.TP
.BR " \-\-summary "
Display details about session recorded in the specified timing file and exit. The session has
to be recorded by "advanced" format (see
.B script (1)
to be recorded by
.I advanced
format (see
.BR script (1))
option \fB\-\-logging\-format\fR for more details).
.TP
.BR \-x , " \-\-stream " \fItype\fR
Forces scriptreplay to print only specified stream. The supported stream types
are 'in' or 'out'. This option is recommended for multi-stream logs (e.g. --log-io)
are
.IR in ,
.IR out ,
.IR signal ,
or
.IR info .
This option is recommended for multi-stream logs (e.g. --log-io)
to print only specified data.
.TP
.BR \-V , " \-\-version"

@ -269,7 +269,7 @@ main(int argc, char *argv[])
err(EXIT_FAILURE, _("cannot open %s"), log_io);
if (!*streams) {
/* output is prefered default */
/* output is preferred default */
if (log_out || log_io)
appendchr(streams, sizeof(streams), 'O');
else if (log_in)

Loading…
Cancel
Save