From: Rich Felker Date: Tue, 5 Apr 2011 16:25:31 +0000 (-0400) Subject: add more legacy functions: setlinebuf and setbuffer X-Git-Tag: v0.7.7~19 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=e72180083e4b0203d1883b6054198decdb60071c;p=oweals%2Fmusl.git add more legacy functions: setlinebuf and setbuffer --- diff --git a/include/stdio.h b/include/stdio.h index 186fdf2c..69178cc8 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -156,6 +156,8 @@ char *cuserid(char *); #define off64_t off_t int asprintf(char **, const char *, ...); int vasprintf(char **, const char *, va_list); +void setlinebuf(FILE *); +void setbuffer(FILE *, char *, size_t); #endif #ifdef __cplusplus diff --git a/src/stdio/setbuf.c b/src/stdio/setbuf.c index 205afcfe..1b98d503 100644 --- a/src/stdio/setbuf.c +++ b/src/stdio/setbuf.c @@ -1,4 +1,4 @@ -#include "stdio_impl.h" +#include void setbuf(FILE *f, char *buf) { diff --git a/src/stdio/setbuffer.c b/src/stdio/setbuffer.c new file mode 100644 index 00000000..71233d2e --- /dev/null +++ b/src/stdio/setbuffer.c @@ -0,0 +1,7 @@ +#define _GNU_SOURCE +#include + +void setbuffer(FILE *f, char *buf, size_t size) +{ + setvbuf(f, buf, buf ? _IOFBF : _IONBF, size); +} diff --git a/src/stdio/setlinebuf.c b/src/stdio/setlinebuf.c new file mode 100644 index 00000000..b93c4d6a --- /dev/null +++ b/src/stdio/setlinebuf.c @@ -0,0 +1,7 @@ +#define _GNU_SOURCE +#include + +void setlinebuf(FILE *f) +{ + setvbuf(f, 0, _IOLBF, 0); +}