[project @ 2000-05-28 17:47:27 by panne]
[ghc-hetmet.git] / ghc / lib / std / cbits / fileEOF.c
1 /* 
2  * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
3  *
4  * $Id: fileEOF.c,v 1.4 1999/11/25 16:54:14 simonmar Exp $
5  *
6  * hIsEOF Runtime Support
7  */
8
9 #include "Rts.h"
10 #include "stgio.h"
11
12 StgInt
13 fileEOF(StgForeignPtr ptr)
14 {
15     IOFileObject* fo = (IOFileObject*)ptr;
16
17     if ( FILEOBJ_IS_EOF(fo) )
18        return 1;
19
20     if (fileLookAhead(ptr) != EOF)
21         return 0;
22     else if (ghc_errtype == ERR_EOF)
23         return 1;
24     else
25         return -1;
26 }