Improve checks for setmode()

As reported by Jonathan, OS X has setmode() that is something other
than what setmode() is on Win32.  So, limit invocation to Windows
platforms only.
This commit is contained in:
Behdad Esfahbod 2013-02-12 15:35:32 -05:00
parent a6c1e040e5
commit e2aab4b5db
3 changed files with 5 additions and 5 deletions

View File

@ -55,8 +55,8 @@ dnl GOBJECT_INTROSPECTION_CHECK([0.9.0])
dnl GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
# Functions and headers
AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap setmode isatty)
AC_CHECK_HEADERS(unistd.h sys/mman.h io.h)
AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap isatty)
AC_CHECK_HEADERS(unistd.h sys/mman.h)
# Compiler flags
AC_CANONICAL_HOST

View File

@ -413,7 +413,7 @@ font_options_t::get_font (void) const
/* read it */
GString *gs = g_string_new (NULL);
char buf[BUFSIZ];
#ifdef HAVE_SETMODE
#if defined(_WIN32) || defined(__CYGWIN__)
setmode (fileno (stdin), _O_BINARY);
#endif
while (!feof (stdin)) {
@ -557,7 +557,7 @@ output_options_t::get_file_handle (void)
if (output_file)
fp = fopen (output_file, "wb");
else {
#ifdef HAVE_SETMODE
#if defined(_WIN32) || defined(__CYGWIN__)
setmode (fileno (stdout), _O_BINARY);
#endif
fp = stdout;

View File

@ -43,7 +43,7 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* for isatty() */
#endif
#ifdef HAVE_IO_H
#if defined(_WIN32) || defined(__CYGWIN__)
#include <io.h> /* for setmode() under Windows */
#endif