2 % (c) The GRASP/AQUA Project, Glasgow University, 1994
4 \subsection[readFile.lc]{hGetContents Runtime Support}
14 readBlock(buf, fp, size)
21 if (feof((FILE *) fp)) {
22 ghc_errtype = ERR_EOF;
27 while ((count = fread(buf, 1, size, (FILE *) fp)) == 0) {
28 if (feof((FILE *) fp)) {
29 ghc_errtype = ERR_EOF;
32 } else if (errno != EINTR) {
37 clearerr((FILE *) fp);
44 readLine(buf, fp, size)
49 if (feof((FILE *) fp)) {
50 ghc_errtype = ERR_EOF;
55 while (fgets(buf, size, (FILE *) fp) == NULL) {
56 if (feof((FILE *) fp)) {
57 ghc_errtype = ERR_EOF;
60 } else if (errno != EINTR) {
65 clearerr((FILE *) fp);
77 if (feof((FILE *) fp)) {
78 ghc_errtype = ERR_EOF;
83 while ((c = getc((FILE *) fp)) == EOF) {
84 if (feof((FILE *) fp)) {
85 ghc_errtype = ERR_EOF;
88 } else if (errno != EINTR) {
93 clearerr((FILE *) fp);
96 if (isatty(fileno((FILE *) fp)) && c == EOT)