[project @ 1998-04-10 10:54:14 by simonm]
[ghc-hetmet.git] / ghc / lib / std / cbits / filePutc.c
1 /* 
2  * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
3  *
4  * $Id: filePutc.c,v 1.1 1998/04/10 10:54:26 simonm Exp $
5  *
6  * hPutChar Runtime Support
7  */
8
9 #include "Rts.h"
10 #include "stgio.h"
11 #include "error.h"
12
13 StgInt
14 filePutc(StgAddr fp, I_ c)
15 {
16     int rc;
17
18     /* Try to write a character */
19     while ((rc = putc((int) c, (FILE *) fp)) == EOF && errno == EINTR)
20         clearerr((FILE *) fp);
21
22     if (rc == EOF) {
23         cvtErrno();
24         stdErrno();
25         return -1;
26     }
27
28     return 0;
29 }