From 09cb80c23ea11cd1225bbc0bacad9b0f9e3e82d6 Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Sat, 4 Sep 2010 21:55:28 +0100 Subject: [PATCH] Portability fixes for DOS/Windows --- src/abcess.h | 24 ++++++++++++++++-------- src/ick_bool.h | 26 ++++++++++++++------------ src/oil.y | 3 ++- 3 files changed, 32 insertions(+), 21 deletions(-) diff --git a/src/abcess.h b/src/abcess.h index 92e0686..e1d0a35 100644 --- a/src/abcess.h +++ b/src/abcess.h @@ -15,16 +15,24 @@ * and avoid such grottiness. */ /*@-redef@*/ -#ifdef __STDC_VERSION__ -#if __STDC_VERSION__ >= 199901L -#include -#endif -#endif #ifndef __bool_true_false_are_defined +# ifdef HAVE_STDBOOL_H +# include +# else +# ifndef HAVE__BOOL +# ifdef HAVE_STDINT_H +# include +typedef int_fast8_t bool; +# else typedef int bool; -#define true 1 -#define false 0 -#define __bool_true_false_are_defined 1 +# endif +# else +typedef _Bool bool +# endif +# define true 1 +# define false 0 +# define __bool_true_false_are_defined 1 +# endif #endif /*@=redef@*/ diff --git a/src/ick_bool.h b/src/ick_bool.h index aae777d..8430c8d 100644 --- a/src/ick_bool.h +++ b/src/ick_bool.h @@ -6,21 +6,23 @@ */ /*@-redef@ -incondefs*/ -#ifdef HAVE_STDBOOL_H -# include -#else -# ifndef HAVE__BOOL -# ifdef HAVE_STDINT_H -# include +#ifndef __bool_true_false_are_defined +# ifdef HAVE_STDBOOL_H +# include +# else +# ifndef HAVE__BOOL +# ifdef HAVE_STDINT_H +# include typedef int_fast8_t bool; -# else +# else typedef int bool; -# endif -# else +# endif +# else typedef _Bool bool +# endif +# define true 1 +# define false 0 +# define __bool_true_false_are_defined 1 # endif -# define true 1 -# define false 0 -# define __bool_true_false_are_defined 1 #endif /*@=redef =incondefs@*/ diff --git a/src/oil.y b/src/oil.y index db26033..ff26cb5 100644 --- a/src/oil.y +++ b/src/oil.y @@ -735,7 +735,8 @@ void splitend(void) " if(c+c1+c2+c3+c4+c5+c6+c7+c8+c9+r+\n" " x+x1+x2+x3+x4+x5+x6+x7+x8+x9) raise(SIGSEGV);\n"); printf(" return opted;\n}\n"); - fclose(stdout); + /* do not close stdout; freopen implicitly closes it anyway, and explicitly + closing it breaks on DOS */ } int main(void) -- 2.43.0