diff options
author | Nicholas <nbnoll@eml.cc> | 2021-11-12 09:22:01 -0800 |
---|---|---|
committer | Nicholas <nbnoll@eml.cc> | 2021-11-12 09:22:01 -0800 |
commit | ce05175372a9ddca1a225db0765ace1127a39293 (patch) | |
tree | 5988b4d4f6b402e4953945886fc90aae11203df6 /src/libfmt/vesprint.c | |
parent | b375f3cdedb5b0e08745d100b40e38d2f8396a58 (diff) |
chore: simplified organizational structurelaptop
Diffstat (limited to 'src/libfmt/vesprint.c')
-rw-r--r-- | src/libfmt/vesprint.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/libfmt/vesprint.c b/src/libfmt/vesprint.c new file mode 100644 index 0000000..18f4dd2 --- /dev/null +++ b/src/libfmt/vesprint.c @@ -0,0 +1,26 @@ +#include "internal.h" + +char* +fmt·vesprint(char *buf, char *end, char *fmt, va_list args) +{ + fmt·State io; + + if(end <= buf) + return nil; + + io.n = 0; + io.buffer.beg = io.buffer.cur = buf; + io.buffer.end = end-1; + io.flush = nil; + io.file = nil; + + va_copy(io.args, args); + + fmt·setlocale(&io, nil, nil, nil); + fmt·do(&io, fmt); + + va_end(io.args); + + *(io.buffer.cur) = 0; + return io.buffer.cur; +} |