[project @ 1996-01-08 20:28:12 by partain]
[ghc-hetmet.git] / ghc / runtime / io / filePutc.lc
1 %
2 % (c) The GRASP/AQUA Project, Glasgow University, 1994
3 %
4 \subsection[filePuc.lc]{hPutChar Runtime Support}
5
6 \begin{code}
7
8 #include "rtsdefs.h"
9 #include "stgio.h"
10 #include "error.h"
11
12 StgInt
13 filePutc(fp, c)
14 StgAddr fp;
15 StgInt c;
16 {
17     int rc;
18
19     /* Try to read a character */
20     while ((rc = putc((int) c, (FILE *) fp)) == EOF && errno == EINTR)
21         clearerr((FILE *) fp);
22
23     if (rc == EOF) {
24         cvtErrno();
25         stdErrno();
26         return -1;
27     }
28
29     return 0;
30 }
31
32 \end{code}