ref: bf70c2f9d9e10fa5eb226ace7dbbfb998dd7c3be
dir: /libc/werrstr.c/
#include <u.h> #include <libc.h> char errbuf[ERRMAX]; int errstr(char *buf, uint n) { if(n > ERRMAX) n = ERRMAX; utfecpy(errbuf, errbuf+n, buf); return utflen(buf); } int rerrstr(char *buf, uint n) { utfecpy(buf, buf+n, errbuf); return utflen(buf); } void werrstr(char *f, ...) { va_list arg; va_start(arg, f); vsnprint(errbuf, sizeof errbuf, f, arg); va_end(arg); }