.RI [ file ]
.SH DESCRIPTION
.B script
-makes a typescript of everything displayed on your terminal. It is useful for
-students who need a hardcopy record of an interactive session as proof of an
-assignment, as the typescript file can be printed out later with
-.BR lpr (1).
+makes a typescript of everything on your terminal session. The terminal
+data are stored in raw form to the log file and information about timing
+to another (optional) structured log file. The timing log file is necessary to replay
+the session later by
+.B scriptreplay (1)
+and to store additional information about the session.
+.PP
Since version 2.35
.B script
supports multiple streams and allows to log input and output to separate
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
\fB\-\-log\-in\fR and \fB\-\-log\-out\fR are used together.
+See also \fB\-\-log\-format\fR.
+.TP
+\fB\-m\fR, \fB\-\-log\-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.
.sp
.RS
.B Classic format
field indicates how much time elapsed since the previous output. The second
field indicates how many characters were output this time.
.sp
-.B Multi-stream format
+.B Advanced (multi-stream) format
.PP
The first field is entry type itentifier ('I'nput, 'O'utput, 'H'eader, 'S'ignal).
The socond field is how much time elapsed since the previous entry, and rest of the entry is type specific data.
*/
enum {
SCRIPT_FMT_RAW = 1, /* raw slave/master data */
- SCRIPT_FMT_TIMING_SIMPLE, /* timing info in classic "<delta> <offset>" format */
- SCRIPT_FMT_TIMING_MULTI, /* multiple streams in format "<type> <delta> <offset|etc> */
+ SCRIPT_FMT_TIMING_SIMPLE, /* (classic) in format "<delta> <offset>" */
+ SCRIPT_FMT_TIMING_MULTI, /* (advanced) multiple streams in format "<type> <delta> <offset|etc> */
};
struct script_log {
fputs(_(" -T, --log-timing <file> log timing information to file\n"), out);
fputs(_(" -t[<file>], --timing[=<file>] deprecated alias to -T (default file is stderr)\n"), out);
+ fputs(_(" -m, --logging-format <name> force to 'classic' or 'advanced' format\n"), out);
fputs(USAGE_SEPARATOR, out);
fputs(_(" -a, --append append to the log file\n"), out);
{"log-out", required_argument, NULL, 'O'},
{"log-io", required_argument, NULL, 'B'},
{"log-timing", required_argument, NULL, 'T'},
+ {"logging-format", required_argument, NULL, 'm'},
{"output-limit", required_argument, NULL, 'o'},
{"quiet", no_argument, NULL, 'q'},
{"timing", optional_argument, NULL, 't'},
script_init_debug();
- while ((ch = getopt_long(argc, argv, "aB:c:efI:O:o:qT:t::Vh", longopts, NULL)) != -1) {
+ while ((ch = getopt_long(argc, argv, "aB:c:efI:O:o:qm:T:t::Vh", longopts, NULL)) != -1) {
err_exclusive_options(ch, longopts, excl, excl_st);
case 'q':
ctl.quiet = 1;
break;
+ case 'm':
+ if (strcasecmp(optarg, "classic") == 0)
+ format = SCRIPT_FMT_TIMING_SIMPLE;
+ else if (strcasecmp(optarg, "advanced") == 0)
+ format = SCRIPT_FMT_TIMING_MULTI;
+ else
+ errx(EXIT_FAILURE, _("unssuported logging format: '%s'"), optarg);
+ break;
case 't':
if (optarg && *optarg == '=')
optarg++;
format = outfile && infile ?
SCRIPT_FMT_TIMING_MULTI :
SCRIPT_FMT_TIMING_SIMPLE;
+
+ else if (format == SCRIPT_FMT_TIMING_SIMPLE && outfile && infile)
+ errx(EXIT_FAILURE, _("log multiple streams is mutually "
+ "exclusive with 'classic' format"));
if (outfile)
log_associate(&ctl, &ctl.out, timingfile, format);
if (infile)