diff options
author | Nicholas <nbnoll@eml.cc> | 2021-11-11 17:07:44 -0800 |
---|---|---|
committer | Nicholas <nbnoll@eml.cc> | 2021-11-11 17:07:44 -0800 |
commit | b375f3cdedb5b0e08745d100b40e38d2f8396a58 (patch) | |
tree | a51d5763646ff482c26e79bfc1dcebccbe4812a7 /sys/libfmt/write.c | |
parent | 44b30ea0883af2827e618a45d472b47cf041a842 (diff) | |
parent | 9695ea005d4af93dcd60f74f10fd3c54499a182f (diff) |
chore: merge master into laptop
Diffstat (limited to 'sys/libfmt/write.c')
-rw-r--r-- | sys/libfmt/write.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sys/libfmt/write.c b/sys/libfmt/write.c new file mode 100644 index 0000000..9a77223 --- /dev/null +++ b/sys/libfmt/write.c @@ -0,0 +1,22 @@ +#include "internal.h" + +int +fmt·write(fmt·State *io, char *fmt, ...) +{ + int n; + va_list args; + + io->flag = io->width = io->prec = 0; + + va_copy(args, io->args); + va_end(io->args); + + va_start(io->args, fmt); + n = fmt·do(io, fmt); + va_end(io->args); + + io->flag = io->width = io->prec = 0; + if(n >= 0) + return 0; + return n; +} |