Allow the default output destination, i.e. the typescript file, to be a hard
or symbolic link. The command will follow a symbolic link.
.TP
+\fB\-I\fR, \fB\-\-log\-in\fR \fIfile\fR
+Log input to the \fIfile\fR. The log output is disabled if only \fB\-\-log\-in\fR
+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).
+.TP
\fB\-O\fR, \fB\-\-log\-out\fR \fIfile\fR
-Log output to the \fIfile\fR. The default is to log the file with name 'typescript'
-if the option is not given.
+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.
.TP
\fB\-T\fR, \fB\-\-log\-timing\fR \fIfile\fR
Log timing information to the \fIfile\fR.
fputs(_("Make a typescript of a terminal session.\n"), out);
fputs(USAGE_OPTIONS, out);
+ fputs(_(" -I, --log-in <file> log stdin to file\n"), out);
fputs(_(" -O, --log-out <file> log stdout to file (default)\n"), out);
fputs(_(" -T, --log-timing <file> log timing information to file\n"), out);
fputs(_(" -a, --append append the output\n"), out);
.poll_timeout = -1
};
int ch;
- const char *typescript = DEFAULT_TYPESCRIPT_FILENAME;
+ const char *outfile = NULL, *infile = NULL;
const char *timingfile = NULL;
enum { FORCE_OPTION = CHAR_MAX + 1 };
{"return", no_argument, NULL, 'e'},
{"flush", no_argument, NULL, 'f'},
{"force", no_argument, NULL, FORCE_OPTION,},
+ {"log-in", required_argument, NULL, 'I'},
{"log-out", required_argument, NULL, 'O'},
{"log-timing", required_argument, NULL, 'T'},
{"output-limit", required_argument, NULL, 'o'},
script_init_debug();
- while ((ch = getopt_long(argc, argv, "ac:efO:o:qT:t::Vh", longopts, NULL)) != -1) {
+ while ((ch = getopt_long(argc, argv, "ac:efI:O:o:qT:t::Vh", longopts, NULL)) != -1) {
err_exclusive_options(ch, longopts, excl, excl_st);
case FORCE_OPTION:
ctl.force = 1;
break;
+ case 'I':
+ log_associate(&ctl, &ctl.in, optarg, SCRIPT_FMT_RAW);
+ infile = optarg;
+ break;
case 'O':
- typescript = optarg;
+ log_associate(&ctl, &ctl.out, optarg, SCRIPT_FMT_RAW);
+ outfile = optarg;
break;
case 'o':
ctl.maxsz = strtosize_or_err(optarg, _("failed to parse output limit size"));
argc -= optind;
argv += optind;
- if (!typescript) {
+ /* default if no --log-* specified */
+ if (!outfile && !infile) {
if (argc > 0)
- typescript = argv[0];
- else
+ outfile = argv[0];
+ else {
die_if_link(&ctl, DEFAULT_TYPESCRIPT_FILENAME);
- }
+ outfile = DEFAULT_TYPESCRIPT_FILENAME;
+ }
- /* associate stdout with typescript file */
- log_associate(&ctl, &ctl.out, typescript, SCRIPT_FMT_RAW);
+ /* associate stdout with typescript file */
+ log_associate(&ctl, &ctl.out, outfile, SCRIPT_FMT_RAW);
+ }
ctl.shell = getenv("SHELL");
if (ctl.shell == NULL)
getmaster(&ctl);
if (!ctl.quiet) {
- if (!timingfile)
- printf(_("Script started, log file is '%s'.\n"), typescript);
- else
- printf(_("Script started, log file is '%s', timing file is '%s'.\n"),
- typescript, timingfile);
+ printf(_("Script started"));
+ if (outfile)
+ printf(_(", output log file is '%s'"), outfile);
+ if (infile)
+ printf(_(", input log file is '%s'"), infile);
+ if (timingfile)
+ printf(_(", timing file is '%s'"), timingfile);
+ printf(_(".\n"));
}
enable_rawmode_tty(&ctl);