summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-02-27 21:21:02 -0500
committerJakob Kaivo <jkk@ung.org>2019-02-27 21:21:02 -0500
commit4922f9cd5f507d9206b37333437c3397df07164a (patch)
tree4e7d935f26e2c6c651672b6c37cf9843dd8e41a9
parent387a9f5702a0bd867df3116fd8f5a24a05f8633e (diff)
make "write" syscall directly if _POSIX_SOURCE is not defined
-rw-r--r--src/stdio/fputc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/stdio/fputc.c b/src/stdio/fputc.c
index 7b80f0ef..2d748751 100644
--- a/src/stdio/fputc.c
+++ b/src/stdio/fputc.c
@@ -5,7 +5,8 @@
#include "sys/types.h"
#include "unistd.h"
#else
-#define write(fd, buf, size) -1
+#include "nonstd/syscall.h"
+#define write(_fd, _buf, _size) __syscall(__lookup("write"), _fd, _buf, _size)
#endif
/** write a character to a file stream **/
@@ -24,10 +25,7 @@ int fputc(int c, FILE *stream)
}
funlockfile(stream);
- /*
- RETURN_SUCCESS(ARGUMENT(c));
- RETURN_FAILURE(CONSTANT(EOF));
- */
+
return ch;
}
@@ -38,6 +36,9 @@ file position indicator, which is advanced. If ARGUMENT(stream) does not support
seeking or was opened in append mode, the character is written to the end of
the stream.
***/
+
/*
+RETURN_SUCCESS(ARGUMENT(c))
+RETURN_FAILURE(CONSTANT(EOF))
STDC(1)
*/