From nobody Mon Oct 11 17:04:52 2021 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8CD7C18145CF; Mon, 11 Oct 2021 17:04:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HSlXP1Tsrz4VKR; Mon, 11 Oct 2021 17:04:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C4D6C24C23; Mon, 11 Oct 2021 17:04:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19BH4qtr036679; Mon, 11 Oct 2021 17:04:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19BH4q5D036678; Mon, 11 Oct 2021 17:04:52 GMT (envelope-from git) Date: Mon, 11 Oct 2021 17:04:52 GMT Message-Id: <202110111704.19BH4q5D036678@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 8da27052535b - main - last: improve non-UTF8 locale output after libxo support was added List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8da27052535b816096dd28debe5bbbad3dcf4ea4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=8da27052535b816096dd28debe5bbbad3dcf4ea4 commit 8da27052535b816096dd28debe5bbbad3dcf4ea4 Author: Piotr Pawel Stefaniak AuthorDate: 2021-10-10 07:16:59 +0000 Commit: Piotr Pawel Stefaniak 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) {