git: 31fde973577d - main - script: use %n at the end of default tstamp_fmt

From: Simon J. Gerraty <sjg_at_FreeBSD.org>
Date: Thu, 10 Mar 2022 17:44:19 UTC
The branch main has been updated by sjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=31fde973577d0e09caccf0d762135bfa6b14f1f3

commit 31fde973577d0e09caccf0d762135bfa6b14f1f3
Author:     Simon J. Gerraty <sjg@FreeBSD.org>
AuthorDate: 2022-03-10 17:42:55 +0000
Commit:     Simon J. Gerraty <sjg@FreeBSD.org>
CommitDate: 2022-03-10 17:42:55 +0000

    script: use %n at the end of default tstamp_fmt
    
    Since we are only outputting time-stamps when they differ
    ending it with a newline, interferes with the output less.
---
 usr.bin/script/script.1 | 4 +++-
 usr.bin/script/script.c | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/usr.bin/script/script.1 b/usr.bin/script/script.1
index e6c422b476f5..36523148fa90 100644
--- a/usr.bin/script/script.1
+++ b/usr.bin/script/script.1
@@ -131,8 +131,10 @@ If
 does not contain any
 .Ql %
 characters, it indicates the default format:
-.Ql %n@ %s [%Y-%m-%d %T]\  ,
+.Ql %n@ %s [%Y-%m-%d %T]%n ,
 which is useful for both tools and humans to read, should be used.
+Note that time-stamps will only be output when different from the
+previous one.
 .El
 .Pp
 The script ends when the forked shell (or command) exits (a
diff --git a/usr.bin/script/script.c b/usr.bin/script/script.c
index e469b13fc65b..430f48ad63df 100644
--- a/usr.bin/script/script.c
+++ b/usr.bin/script/script.c
@@ -91,7 +91,7 @@ static struct termios tt;
 
 #ifndef TSTAMP_FMT
 /* useful for tool and human reading */
-# define TSTAMP_FMT "%n@ %s [%Y-%m-%d %T] "
+# define TSTAMP_FMT "%n@ %s [%Y-%m-%d %T]%n"
 #endif
 static const char *tstamp_fmt = TSTAMP_FMT;
 static int tflg;