Skip to contentSkip to conversation

script: --quiet option is not quiet.

PATCH In review Andreas Henriksson 2 participants 3 messages Jun 21, 2014 – Jun 23, 2014 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 script: --quiet option is not quiet.

From: James Hunt <[email protected]>

Specifying 'script --quiet ...' still produces the 'Script started' message in the typescript file. The --quiet option implies that the script program should not log any of its output to the typescript file.

Originally reported at:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=693966

---
 term-utils/script.1 | 3 ++-
 term-utils/script.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
term-utils/script.1 +2 -1
index 60a0e53..67e1066 100644
@@ -82,7 +82,8 @@ 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\-q\fR, \fB\-\-quiet\fR
-Be quiet.
+Be quiet (do not write start and done messages to either standard output
+or the typescript file).
 .TP
 \fB\-t\fR, \fB\-\-timing\fR[=\fIfile\fR]
 Output timing data to standard error, or to
term-utils/script.c +2 -1
index 1530e67..21fb5af 100644
@@ -437,7 +437,8 @@ dooutput(void) {
 
 	tvec = time((time_t *)NULL);
 	my_strftime(obuf, sizeof obuf, "%c\n", localtime(&tvec));
-	fprintf(fscript, _("Script started on %s"), obuf);
+	if (!qflg)
+		fprintf(fscript, _("Script started on %s"), obuf);
 
 	FD_ZERO(&readfds);
 
Signature · 1 line
2.0.0
#1 lore raw

PATCH 2/2 script: silence the done message on --quiet as well

Apparently James Hunts patch (which he provided a long time ago) is no longer covering it all.

This followup patch also silences the "Script done ..." message when --quiet is used.

---
 term-utils/script.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
term-utils/script.c +2 -1
index 21fb5af..2da7512 100644
@@ -578,7 +578,8 @@ done(void) {
 			char buf[BUFSIZ];
 			tvec = time((time_t *)NULL);
 			my_strftime(buf, sizeof buf, "%c\n", localtime(&tvec));
-			fprintf(fscript, _("\nScript done on %s"), buf);
+			if (!qflg)
+				fprintf(fscript, _("\nScript done on %s"), buf);
 
 			if (close_stream(fscript) != 0)
 				errx(EXIT_FAILURE, _("write error"));
Signature · 1 line
2.0.0
maintainer
#2 lore raw
In reply to Andreas Henriksson
Quoted 3 lines · Andreas Henriksson
 term-utils/script.1 | 3 ++-
 term-utils/script.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

Both patches applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com