summaryrefslogtreecommitdiff
path: root/src/stdio/feof.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdio/feof.c')
-rw-r--r--src/stdio/feof.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/stdio/feof.c b/src/stdio/feof.c
new file mode 100644
index 00000000..26c9a5a8
--- /dev/null
+++ b/src/stdio/feof.c
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include "nonstd/io.h"
+#include "nonstd/assert.h"
+
+/** test for end-of-file **/
+int feof(FILE *stream)
+{
+ ASSERT_NONNULL(stream);
+ flockfile(stream);
+
+ if (stream->eof) {
+ return 1;
+ }
+ /* TODO */
+ /* system level test */
+ funlockfile(stream);
+ /*
+ RETURN(0, the end-of-file indicator is not set);
+ RETURN(NONZERO, the end-of-file indicator is set);
+ */
+ return stream->eof;
+}
+
+/***
+tests for the end-of-file indicator of ARGUMENT(stream).
+***/
+/*
+STDC(1)
+*/