diff options
author | Manuel Novoa III <mjn3@codepoet.org> | 2001-02-15 16:20:14 +0000 |
---|---|---|
committer | Manuel Novoa III <mjn3@codepoet.org> | 2001-02-15 16:20:14 +0000 |
commit | 0ba092c1c9d7ff6091a80db79d4d6b26162ad50c (patch) | |
tree | 13d3e4330c8703cba06b2a721f1e022bc809a266 | |
parent | 55452223c9d676bcf29601948a97aa10f322fd10 (diff) |
Add vdprintf function. Note: will be rewritten to check if file descriptor has an associated FILE to avoid bad interactions with buffered output, but needed for busybox right now and that implementation has the same bug.
-rw-r--r-- | libc/stdio/Makefile | 2 | ||||
-rw-r--r-- | libc/stdio/printf.c | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/libc/stdio/Makefile b/libc/stdio/Makefile index 2ad7cd737..50f3bd602 100644 --- a/libc/stdio/Makefile +++ b/libc/stdio/Makefile @@ -41,7 +41,7 @@ MOBJ=_stdio_init.o fputc.o fgetc.o fflush.o fgets.o gets.o fputs.o \ MSRC2=printf.c MOBJ2=printf.o sprintf.o fprintf.o vprintf.o vsprintf.o vfprintf.o snprintf.o \ - vsnprintf.o asprintf.o vfnprintf.o fnprintf.o + vsnprintf.o asprintf.o vfnprintf.o fnprintf.o vdprintf.o MSRC3=scanf.c MOBJ3=scanf.o sscanf.o fscanf.o vscanf.o vsscanf.o vfscanf.o diff --git a/libc/stdio/printf.c b/libc/stdio/printf.c index 3a7dda007..898d0b94e 100644 --- a/libc/stdio/printf.c +++ b/libc/stdio/printf.c @@ -279,6 +279,17 @@ int vsnprintf(char *sp, size_t size, __const char *fmt, va_list ap) } #endif +#ifdef L_vdprintf +#warning rewrite vdprintf ... fd may have an associated file!!! plus buffer? +extern int vdprintf(int fd, const char *fmt, va_list ap) +{ + FILE f = {f.unbuf, f.unbuf, f.unbuf, f.unbuf, f.unbuf + sizeof(f.unbuf), + fd, _IONBF | __MODE_WRITE | __MODE_IOTRAN}; + + return vfnprintf(&f, -1, fmt, ap); +} +#endif + #ifdef L_vfnprintf extern char *__ultostr(char *buf, unsigned long uval, int base, int uppercase); |