diff options
author | Andriy Gapon <avg@FreeBSD.org> | 2020-12-03 11:59:40 +0000 |
---|---|---|
committer | Andriy Gapon <avg@FreeBSD.org> | 2020-12-03 11:59:40 +0000 |
commit | b946eede043435cad44e6fec9e553bdf1760c5b8 (patch) | |
tree | dae0eb3dc4e532fe98aa82403949ed98ca90ea51 | |
parent | 3e5cd548af0da7b2425dce62d308ebc9b41470b7 (diff) | |
download | src-b946eede043435cad44e6fec9e553bdf1760c5b8.tar.gz src-b946eede043435cad44e6fec9e553bdf1760c5b8.zip |
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
Notes
Notes:
svn path=/head/; revision=368300
-rw-r--r-- | cddl/contrib/opensolaris/cmd/dtrace/dtrace.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c index 393a7217df25..06eff2055c17 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c +++ b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c @@ -51,6 +51,7 @@ #include <libproc.h> #endif #ifdef __FreeBSD__ +#include <locale.h> #include <spawn.h> #endif @@ -1316,6 +1317,14 @@ main(int argc, char *argv[]) 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]); if (argc == 1) |