Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Aug 2019 15:50:13 +0000 (UTC)
From:      Eugene Grosbein <eugen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r351459 - head/usr.bin/last
Message-ID:  <201908241550.x7OFoD80037926@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eugen
Date: Sat Aug 24 15:50:13 2019
New Revision: 351459
URL: https://svnweb.freebsd.org/changeset/base/351459

Log:
  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

Modified:
  head/usr.bin/last/last.c

Modified: head/usr.bin/last/last.c
==============================================================================
--- head/usr.bin/last/last.c	Sat Aug 24 15:38:07 2019	(r351458)
+++ head/usr.bin/last/last.c	Sat Aug 24 15:50:13 2019	(r351459)
@@ -92,8 +92,8 @@ static const	char *crmsg;			/* cause of last reboot */
 static time_t	currentout;			/* current logout value */
 static long	maxrec;				/* records to display */
 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	utf8flag;			/* current locale is UTF-8 */
 static int	width = 5;			/* show seconds in delta */
 static int	yflag;				/* show year */
 static int      d_first;
@@ -120,7 +120,7 @@ ctf(const char *fmt) {
 	const char  *src, *end;
 	char	    *dst;
 
-	if (utf8flag)
+	if (noctfix)
 		return (fmt);
 
 	end = buf + sizeof(buf);
@@ -158,7 +158,9 @@ main(int argc, char *argv[])
 	d_first = (*nl_langinfo(D_MD_ORDER) == 'd');
 
 	(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);
 	if (argc < 0)



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