From 453792c501b4553ed3c4135057249e300d3c0362 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 24 Jun 2015 11:26:33 +0100 Subject: [PATCH] lib: Enable locale dependent output to a terminal If we are in an interactive session, enable the locale. This allows for features like setting thousand separators for printing large values. By only enabling it for interactive terminals, we avoid changing outputs for the test scripts (leaving them as the "C" locale). Note this mainly affects the testcases, or binaries built using libigt. Other binaries need to be localised separately. Signed-off-by: Chris Wilson Reviewed-by: Michel Thierry --- lib/igt_core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/igt_core.c b/lib/igt_core.c index 2cf23934..051bc6a4 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -55,6 +55,7 @@ #include #include #include +#include #include "drmtest.h" #include "intel_chipset.h" @@ -522,6 +523,9 @@ static int common_init(int *argc, char **argv, int ret = 0; char *env = getenv("IGT_LOG_LEVEL"); + if (isatty(STDOUT_FILENO)) + setlocale(LC_ALL, ""); + if (env) { if (strcmp(env, "debug") == 0) igt_log_level = IGT_LOG_DEBUG;