diff options
author | Stephen Dolan <mu@netsoc.tcd.ie> | 2012-12-20 12:16:22 +0000 |
---|---|---|
committer | Stephen Dolan <mu@netsoc.tcd.ie> | 2012-12-20 12:16:22 +0000 |
commit | c85d8d8b4ef210c25f1c3492c7790e0ddbcb2c3b (patch) | |
tree | 02f8f791acd14121e31cdc00e3bde484c8979663 | |
parent | dcdb996085f9e5efe142675195a3a0197c81e211 (diff) |
Don't enable coloured output by default on Windows.
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | main.c | 7 |
2 files changed, 9 insertions, 4 deletions
@@ -1,5 +1,5 @@ CC=gcc -CFLAGS=-Wextra -Wall -Wno-missing-field-initializers -Wno-unused-parameter -std=gnu99 -ggdb -Wno-unused-function +CFLAGS=-Wextra -Wall -Wno-missing-field-initializers -Wno-unused-parameter -std=gnu99 -ggdb -Wno-unused-function $(EXTRA_CFLAGS) prefix=/usr/local mandir=$(prefix)/share/man @@ -50,8 +50,8 @@ build/osx64%: CC='i686-apple-darwin10-gcc -m64' # On Debian, you can get windows compilers in the # gcc-mingw-w64-i686 and gcc-mingw-w64-x86-64 packages. -build/win32%: CC='i686-w64-mingw32-gcc -m32' -build/win64%: CC='x86_64-w64-mingw32-gcc -m64' +build/win32%: CC='i686-w64-mingw32-gcc -m32' EXTRA_CFLAGS=-DJQ_DEFAULT_ENABLE_COLOR=0 +build/win64%: CC='x86_64-w64-mingw32-gcc -m64' EXTRA_CFLAGS=-DJQ_DEFAULT_ENABLE_COLOR=0 ALL_BINARIES=$(foreach platform, $(PLATFORMS), $(foreach binary, $(BINARIES), build/$(platform)/$(binary))) @@ -69,7 +69,12 @@ static void process(jv value) { if ((options & RAW_OUTPUT) && jv_get_kind(result) == JV_KIND_STRING) { fwrite(jv_string_value(result), 1, jv_string_length(jv_copy(result)), stdout); } else { - int dumpopts = isatty(fileno(stdout)) ? JV_PRINT_COLOUR : 0; + int dumpopts; +#ifdef JQ_DEFAULT_ENABLE_COLOR + dumpopts = JQ_DEFAULT_ENABLE_COLOR ? JV_PRINT_COLOUR : 0; +#else + dumpopts = isatty(fileno(stdout)) ? JV_PRINT_COLOUR : 0; +#endif if (!(options & COMPACT_OUTPUT)) dumpopts |= JV_PRINT_PRETTY; if (options & ASCII_OUTPUT) dumpopts |= JV_PRINT_ASCII; if (options & COLOUR_OUTPUT) dumpopts |= JV_PRINT_COLOUR; |