diff options
Diffstat (limited to 'ghc/runtime/io/filePutc.lc')
-rw-r--r-- | ghc/runtime/io/filePutc.lc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/ghc/runtime/io/filePutc.lc b/ghc/runtime/io/filePutc.lc new file mode 100644 index 0000000000..bca57bafbe --- /dev/null +++ b/ghc/runtime/io/filePutc.lc @@ -0,0 +1,32 @@ +% +% (c) The GRASP/AQUA Project, Glasgow University, 1994 +% +\subsection[filePuc.lc]{hPutChar Runtime Support} + +\begin{code} + +#include "rtsdefs.h" +#include "stgio.h" +#include "error.h" + +StgInt +filePutc(fp, c) +StgAddr fp; +StgInt c; +{ + int rc; + + /* Try to read a character */ + while ((rc = putc((int) c, (FILE *) fp)) == EOF && errno == EINTR) + clearerr((FILE *) fp); + + if (rc == EOF) { + cvtErrno(); + stdErrno(); + return -1; + } + + return 0; +} + +\end{code} |