diff options
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) +*/ |
