From c65794b50b1bc729e7a4e940b76a973afa3030b9 Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Thu, 11 Nov 2021 14:49:35 -0800 Subject: feat: libfmt prototype added from plan9 --- sys/libfmt/vfprint.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 sys/libfmt/vfprint.c (limited to 'sys/libfmt/vfprint.c') diff --git a/sys/libfmt/vfprint.c b/sys/libfmt/vfprint.c new file mode 100644 index 0000000..4306ea7 --- /dev/null +++ b/sys/libfmt/vfprint.c @@ -0,0 +1,19 @@ +#include "internal.h" + +int +fmt·vfprint(int fd, char *fmt, va_list args) +{ + int n; + fmt·State io; + char buf[256]; + + fmt·open(fd, sizeof(buf), buf, &io); + + va_copy(io.args, args); + n = fmt·do(&io, fmt); + va_end(io.args); + + if(n > 0 && io.flush(&io) < 0) + return -1; + return n; +} -- cgit v1.2.1