#include "internal.h" /* * appendf will append the given formatted string to our buffer. * returns the newly minted string */ int string·appendf(string *s, byte* fmt, ...) { int r, n; va_list args; va_start(args, fmt); do{ r = string·cap(*s) - string·len(*s); n = fmt·vnsprint(*s + string·len(*s), r+1, fmt, args); string·grow(s, 2*string·cap(*s)); }while(n==r); va_end(args); return n; }