Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Oct 2021 17:04:52 GMT
From:      Piotr Pawel Stefaniak <pstef@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 8da27052535b - main - last: improve non-UTF8 locale output after libxo support was added
Message-ID:  <202110111704.19BH4q5D036678@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by pstef:

URL: https://cgit.FreeBSD.org/src/commit/?id=8da27052535b816096dd28debe5bbbad3dcf4ea4

commit 8da27052535b816096dd28debe5bbbad3dcf4ea4
Author:     Piotr Pawel Stefaniak <pstef@FreeBSD.org>
AuthorDate: 2021-10-10 07:16:59 +0000
Commit:     Piotr Pawel Stefaniak <pstef@FreeBSD.org>
CommitDate: 2021-10-11 17:02:12 +0000

    last: improve non-UTF8 locale output after libxo support was added
    
    Some strftime(3) conversion specifications will generate strings encoded
    with the current locale, not necessarily UTF8. As per xo_format.5, use
    the h string modifier so that libxo interprets it appropriately.
    
    Reviewed by:    eugen, philip
    Differential Revision:  https://reviews.freebsd.org/D32437
---
 usr.bin/last/last.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr.bin/last/last.c b/usr.bin/last/last.c
index 188f393ae3fc..4b6ac33b8df4 100644
--- a/usr.bin/last/last.c
+++ b/usr.bin/last/last.c
@@ -262,7 +262,7 @@ wtmp(void)
 	(void) strftime(ct, sizeof(ct), "%+", tm);
 	xo_emit("\n{:utxdb/%s}", (file == NULL) ? "utx.log" : file);
 	xo_attr("seconds", "%lu", (unsigned long) t);
-	xo_emit(" begins {:begins/%s}\n", ct);
+	xo_emit(" begins {:begins/%hs}\n", ct);
 	xo_close_container("last-information");
 }
 
@@ -379,7 +379,7 @@ printentry(struct utmpx *bp, struct idtab *tt)
 		break;
 	}
 	xo_attr("seconds", "%lu", (unsigned long)t);
-	xo_emit(" {:login-time/%s%c/%s}", ct, tt == NULL ? '\n' : ' ');
+	xo_emit(" {:login-time/%hs%c/%s}", ct, tt == NULL ? '\n' : ' ');
 	if (tt == NULL)
 		goto end;
 	if (!tt->logout) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202110111704.19BH4q5D036678>