From: Michel Thierry <michel.thierry@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
"intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>
Subject: Re: [igt] Enable locale dependent output to a terminal
Date: Wed, 24 Jun 2015 13:23:42 +0100 [thread overview]
Message-ID: <558AA14E.7090309@intel.com> (raw)
In-Reply-To: <1435141768-23816-1-git-send-email-chris@chris-wilson.co.uk>
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@intel.com>
>
> Signed-off-by: Chris Wilson <chris@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@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-06-24 12:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-24 10:29 [igt] Enable locale dependent output to a terminal Chris Wilson
2015-06-24 12:23 ` Michel Thierry [this message]
2015-06-24 16:04 ` Chris Wilson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=558AA14E.7090309@intel.com \
--to=michel.thierry@intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.