Fix test file comparisons on MinGW

Don't output any DOS line terminators from json_process.

Issue GH-39.
This commit is contained in:
Petri Lehtinen 2011-11-01 19:52:20 +02:00
parent bc98ab6a69
commit 92d9b89d59

View File

@ -19,6 +19,11 @@
#include <locale.h>
#endif
#if _WIN32
#include <io.h> /* for _setmode() */
#include <fcntl.h> /* for _O_BINARY */
#endif
static int getenv_int(const char *name)
{
char *value, *end;
@ -72,6 +77,13 @@ int main(int argc, char *argv[])
return 2;
}
#ifdef _WIN32
/* On Windows, set stdout and stderr to binary mode to avoid
outputting DOS line terminators */
_setmode(_fileno(stdout), _O_BINARY);
_setmode(_fileno(stderr), _O_BINARY);
#endif
indent = getenv_int("JSON_INDENT");
if(indent < 0 || indent > 255) {
fprintf(stderr, "invalid value for JSON_INDENT: %d\n", indent);