[Intel-gfx] [igt] Enable locale dependent output to a terminal
Michel Thierry
michel.thierry at intel.com
Wed Jun 24 05:23:42 PDT 2015
On 6/24/2015 11:29 AM, Chris Wilson wrote:
> 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).
Thanks, I'll follow up with a patch replacing existing %llu with %'llu.
Reviewed-by: Michel Thierry <michel.thierry at intel.com>
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
> lib/igt_core.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index 1367863..8ac1f33 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -55,6 +55,7 @@
> #include <time.h>
> #include <ctype.h>
> #include <limits.h>
> +#include <locale.h>
>
> #include "drmtest.h"
> #include "intel_chipset.h"
> @@ -523,6 +524,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;
> --
> 2.1.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
More information about the Intel-gfx
mailing list