From 09fc65eae3c3490f5212782f2cfff63c674ce7d9 Mon Sep 17 00:00:00 2001 From: Snaipe Date: Fri, 27 Mar 2015 19:50:53 +0100 Subject: [PATCH] Default to ascii charset when on a dumb terminal (or cmd.exe) --- src/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 832a28b..8cb1f7a 100644 --- a/src/main.c +++ b/src/main.c @@ -127,11 +127,14 @@ int main(int argc, char *argv[]) { {0, 0, 0, 0 } }; + bool use_ascii = !strcmp("1", getenv("CRITERION_USE_ASCII") ?: "0") + || !strcmp("dumb", getenv("TERM") ?: "dumb"); + criterion_options = (struct criterion_options) { .always_succeed = !strcmp("1", getenv("CRITERION_ALWAYS_SUCCEED") ?: "0"), .no_early_exit = !strcmp("1", getenv("CRITERION_NO_EARLY_EXIT") ?: "0"), .fail_fast = !strcmp("1", getenv("CRITERION_FAIL_FAST") ?: "0"), - .use_ascii = !strcmp("1", getenv("CRITERION_USE_ASCII") ?: "0"), + .use_ascii = use_ascii, .logging_threshold = atoi(getenv("CRITERION_VERBOSITY_LEVEL") ?: "2"), #ifdef HAVE_FNMATCH .pattern = getenv("CRITERION_TEST_PATTERN"),