last(1): correction after r351413
Make that change no-op for C/POSIX locale just like for UTF-8 that it superset of US-ASCII. MFC after: 2 weeks X-MFC-With: r351413
This commit is contained in:
parent
d2757137b8
commit
0ca58ca151
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=351459
@ -92,8 +92,8 @@ static const char *crmsg; /* cause of last reboot */
|
|||||||
static time_t currentout; /* current logout value */
|
static time_t currentout; /* current logout value */
|
||||||
static long maxrec; /* records to display */
|
static long maxrec; /* records to display */
|
||||||
static const char *file = NULL; /* utx.log file */
|
static const char *file = NULL; /* utx.log file */
|
||||||
|
static int noctfix = 0; /* locale is C or UTF-8 */
|
||||||
static int sflag = 0; /* show delta in seconds */
|
static int sflag = 0; /* show delta in seconds */
|
||||||
static int utf8flag; /* current locale is UTF-8 */
|
|
||||||
static int width = 5; /* show seconds in delta */
|
static int width = 5; /* show seconds in delta */
|
||||||
static int yflag; /* show year */
|
static int yflag; /* show year */
|
||||||
static int d_first;
|
static int d_first;
|
||||||
@ -120,7 +120,7 @@ ctf(const char *fmt) {
|
|||||||
const char *src, *end;
|
const char *src, *end;
|
||||||
char *dst;
|
char *dst;
|
||||||
|
|
||||||
if (utf8flag)
|
if (noctfix)
|
||||||
return (fmt);
|
return (fmt);
|
||||||
|
|
||||||
end = buf + sizeof(buf);
|
end = buf + sizeof(buf);
|
||||||
@ -158,7 +158,9 @@ main(int argc, char *argv[])
|
|||||||
d_first = (*nl_langinfo(D_MD_ORDER) == 'd');
|
d_first = (*nl_langinfo(D_MD_ORDER) == 'd');
|
||||||
|
|
||||||
(void) setlocale(LC_CTYPE, "");
|
(void) setlocale(LC_CTYPE, "");
|
||||||
utf8flag = (strcmp(nl_langinfo(CODESET), "UTF-8") == 0);
|
p = nl_langinfo(CODESET);
|
||||||
|
if (strcmp (p, "UTF-8") == 0 || strcmp (p, "US-ASCII") == 0)
|
||||||
|
noctfix = 1;
|
||||||
|
|
||||||
argc = xo_parse_args(argc, argv);
|
argc = xo_parse_args(argc, argv);
|
||||||
if (argc < 0)
|
if (argc < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user