Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Dec 2020 11:59:40 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r368300 - head/cddl/contrib/opensolaris/cmd/dtrace
Message-ID:  <202012031159.0B3Bxekh017004@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Thu Dec  3 11:59:40 2020
New Revision: 368300
URL: https://svnweb.freebsd.org/changeset/base/368300

Log:
  dtrace: honor LC_NUMERIC for %'d and alike, and LC_TIME for %T
  
  Note that the public documentation on dtrace.org fails to mention %T and
  incorrectly documents %Y.  The latter actually uses format "%Y %b %e %T"
  where %b is always in C locale.
  
  Discussed with:	markj
  MFC after:	1 month
  Sponsored by:	Panzura

Modified:
  head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c

Modified: head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c
==============================================================================
--- head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c	Thu Dec  3 11:15:49 2020	(r368299)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c	Thu Dec  3 11:59:40 2020	(r368300)
@@ -51,6 +51,7 @@
 #include <libproc.h>
 #endif
 #ifdef __FreeBSD__
+#include <locale.h>
 #include <spawn.h>
 #endif
 
@@ -1315,6 +1316,14 @@ main(int argc, char *argv[])
 	char *p, **v;
 	struct ps_prochandle *P;
 	pid_t pid;
+
+#ifdef __FreeBSD__
+	/* For %'d and the like. */
+	(void) setlocale(LC_NUMERIC, "");
+
+	/* For %T. */
+	(void) setlocale(LC_TIME, "");
+#endif
 
 	g_pname = basename(argv[0]);
 



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