1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-24 21:33:51 +03:00

xmllint: Set stdin/stdout to binary on Windows

This commit is contained in:
Nick Wellnhofer 2024-06-22 21:01:38 +02:00
parent 4b6e68282b
commit 5589c9ea6f
2 changed files with 16 additions and 0 deletions

View File

@ -13,6 +13,11 @@
#include <stdarg.h>
#include <stdlib.h>
#ifdef _WIN32
#include <fcntl.h>
#include <io.h>
#endif
#ifdef HAVE_LIBREADLINE
#include <readline/readline.h>
#ifdef HAVE_LIBHISTORY
@ -315,6 +320,11 @@ int main(int argc, char **argv) {
int ret;
int exit_value = 0;
#ifdef _WIN32
_setmode(_fileno(stdin), _O_BINARY);
_setmode(_fileno(stdout), _O_BINARY);
_setmode(_fileno(stderr), _O_BINARY);
#endif
if (argc <= 1) {
usage(argv[0]);

View File

@ -2990,6 +2990,12 @@ xmllintMain(int argc, const char **argv, xmlResourceLoader loader) {
maxAmpl = 0;
#endif /* XMLLINT_FUZZ */
#ifdef _WIN32
_setmode(_fileno(stdin), _O_BINARY);
_setmode(_fileno(stdout), _O_BINARY);
_setmode(_fileno(stderr), _O_BINARY);
#endif
if (argc <= 1) {
usage(ERR_STREAM, argv[0]);
return(XMLLINT_ERR_UNCLASS);