vseprint.c - 9base - revived minimalist port of Plan 9 userland to Unix
 (HTM) git clone git://git.suckless.org/9base
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       vseprint.c (479B)
       ---
            1 /* Copyright (c) 2002-2006 Lucent Technologies; see LICENSE */
            2 #include <stdarg.h>
            3 #include "plan9.h"
            4 #include "fmt.h"
            5 #include "fmtdef.h"
            6 
            7 char*
            8 vseprint(char *buf, char *e, char *fmt, va_list args)
            9 {
           10         Fmt f;
           11 
           12         if(e <= buf)
           13                 return nil;
           14         f.runes = 0;
           15         f.start = buf;
           16         f.to = buf;
           17         f.stop = e - 1;
           18         f.flush = 0;
           19         f.farg = nil;
           20         f.nfmt = 0;
           21         VA_COPY(f.args,args);
           22         fmtlocaleinit(&f, nil, nil, nil);
           23         dofmt(&f, fmt);
           24         VA_END(f.args);
           25         *(char*)f.to = '\0';
           26         return (char*)f.to;
           27 }
           28