diff options
author | Nicholas Noll <nbnoll@eml.cc> | 2021-11-11 14:49:35 -0800 |
---|---|---|
committer | Nicholas Noll <nbnoll@eml.cc> | 2021-11-11 14:49:35 -0800 |
commit | c65794b50b1bc729e7a4e940b76a973afa3030b9 (patch) | |
tree | bc435fea0f3179ac9a4b8de9fdaf993dade9e4ff /sys/libfmt/vfprint.c | |
parent | cc7d219e080263da9813e570436bfd34ab8b1bff (diff) |
feat: libfmt prototype added from plan9
Diffstat (limited to 'sys/libfmt/vfprint.c')
-rw-r--r-- | sys/libfmt/vfprint.c | 19 |
1 files changed, 19 insertions, 0 deletions
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; +} |