diff options
author | Jakob Kaivo <jkk@ung.org> | 2020-03-04 03:14:54 -0500 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2020-03-04 03:14:54 -0500 |
commit | 2c6147ab6c567babf07b85820e99f541e423614a (patch) | |
tree | 9067b51de895125ecfee07bc57c254d6fb4f8fad /src/stdio/getc_unlocked.c | |
parent | 584c5b3e93e3007dfb16bcb43d901df74be21116 (diff) |
fix compilation when c=199409
Diffstat (limited to 'src/stdio/getc_unlocked.c')
-rw-r--r-- | src/stdio/getc_unlocked.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/stdio/getc_unlocked.c b/src/stdio/getc_unlocked.c new file mode 100644 index 00000000..8abae5de --- /dev/null +++ b/src/stdio/getc_unlocked.c @@ -0,0 +1,23 @@ +#include <stdio.h> +#include "_stdio.h" +#include "unistd.h" + +int getc_unlocked(FILE * stream) +{ + char c = 0; + + if (!stream) { + return EOF; + } + + if (read(stream->fd, &c, sizeof(c)) != 1) { + stream->err = 1; + return EOF; + } + + return c; +} + +/* +POSIX(199506) +*/ |