1
0
mirror of https://github.com/stedolan/jq.git synced 2024-05-11 05:55:39 +00:00

Don't enable coloured output by default on Windows.

This commit is contained in:
Stephen Dolan
2012-12-20 12:16:22 +00:00
parent dcdb996085
commit c85d8d8b4e
2 changed files with 9 additions and 4 deletions

View File

@ -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)))

7
main.c
View File

@ -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;