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
This commit is contained in:
parent
902cde5d0a
commit
8da2705253
@ -262,7 +262,7 @@ wtmp(void)
|
|||||||
(void) strftime(ct, sizeof(ct), "%+", tm);
|
(void) strftime(ct, sizeof(ct), "%+", tm);
|
||||||
xo_emit("\n{:utxdb/%s}", (file == NULL) ? "utx.log" : file);
|
xo_emit("\n{:utxdb/%s}", (file == NULL) ? "utx.log" : file);
|
||||||
xo_attr("seconds", "%lu", (unsigned long) t);
|
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");
|
xo_close_container("last-information");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,7 +379,7 @@ printentry(struct utmpx *bp, struct idtab *tt)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
xo_attr("seconds", "%lu", (unsigned long)t);
|
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)
|
if (tt == NULL)
|
||||||
goto end;
|
goto end;
|
||||||
if (!tt->logout) {
|
if (!tt->logout) {
|
||||||
|
Loading…
Reference in New Issue
Block a user