From b8992c39b958c68d95a2e2d8268bb6fbcbdb39d8 Mon Sep 17 00:00:00 2001 From: sof Date: Wed, 7 Nov 2001 19:37:17 +0000 Subject: [PATCH] [project @ 2001-11-07 19:37:17 by sof] made to work on Unices --- ghc/lib/std/cbits/PrelIOUtils.c | 9 ++++++++- ghc/lib/std/cbits/dirUtils.c | 18 ++++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/ghc/lib/std/cbits/PrelIOUtils.c b/ghc/lib/std/cbits/PrelIOUtils.c index 9176d28..feabc8b 100644 --- a/ghc/lib/std/cbits/PrelIOUtils.c +++ b/ghc/lib/std/cbits/PrelIOUtils.c @@ -5,6 +5,13 @@ */ #include "HsStd.h" #include "PrelIOUtils.h" +#include +#include +#include + +#ifndef offsetof +#define offsetof(t, f) ((size_t) &((t *)0)->f) +#endif #ifdef _WIN32 #include @@ -54,7 +61,7 @@ HsInt prel_setmode(HsInt fd, HsBool toBin) #ifdef _WIN32 return setmode(fd,(toBin == HS_BOOL_TRUE) ? _O_BINARY : _O_TEXT); #else - return EOK; + return 0; #endif } diff --git a/ghc/lib/std/cbits/dirUtils.c b/ghc/lib/std/cbits/dirUtils.c index 40c846b..edced70 100644 --- a/ghc/lib/std/cbits/dirUtils.c +++ b/ghc/lib/std/cbits/dirUtils.c @@ -7,7 +7,21 @@ #if defined(mingw32_TARGET_OS) #include -#include +#endif + +#ifdef HAVE_STDLIB_H +# include +#endif +#ifdef HAVE_STDDEF_H +# include +#endif + +#ifdef HAVE_ERRNO_H +# include +#endif + +#ifndef offsetof +#define offsetof(t, f) ((size_t) &((t *)0)->f) #endif HsInt @@ -58,7 +72,7 @@ HsAddr prel_d_name(struct dirent* d) HsInt prel_end_of_dir() { #ifndef mingw32_TARGET_OS - return EOK; + return 0; #else return ENOENT; #endif -- 1.7.10.4