ref: 5e9c01fa0f471e4449d7bf96b1903f89b761e0fc
dir: /unix/seprint.c/
#include <stdio.h> #include <stdarg.h> char * seprint(char *buf, char *e, char *fmt, ...) { va_list a; int n, m; if(e <= buf) return e; va_start(a, fmt); m = e-buf-1; n = vsnprintf(buf, m, fmt, a); va_end(a); return buf + (n < m ? n : m); }