scripts uses either a free-standing "file" argument, or the value
passed as --log-out "file". Additional filenames are ignored.
They are also ignored if --log-in "file" is given, as it turns off
output logging by default (can still be overriden by adding --log-out).
Avoid surprises when passing multiple filenames by writing usage
message instead.
[kzak@redhat.com: - use errtryhelp() rather than usage()]
Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=
1016193
Signed-off-by: Karel Zak <kzak@redhat.com>
/* default if no --log-* specified */
if (!outfile && !infile) {
- if (argc > 0)
+ if (argc > 0) {
outfile = argv[0];
- else {
+ argc--;
+ argv++;
+ } else {
die_if_link(&ctl, DEFAULT_TYPESCRIPT_FILENAME);
outfile = DEFAULT_TYPESCRIPT_FILENAME;
}
log_associate(&ctl, &ctl.out, outfile, SCRIPT_FMT_RAW);
}
+ if (argc > 0) {
+ /* only one filename is accepted. if --log-out was given,
+ * freestanding filename is ignored */
+ warnx(_("unexpected number of arguments"));
+ errtryhelp(EXIT_FAILURE);
+ }
+
if (timingfile) {
/* the old SCRIPT_FMT_TIMING_SIMPLE should be used when
* recoding output only (just for backward compatibility),