Annotation of researchv10no/libc/stdio/sprintf.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * pANS stdio -- sprintf
                      3:  */
                      4: #include "iolib.h"
                      5: int sprintf(char *buf, const char *fmt, ...){
                      6:        int n;
                      7:        va_list args;
                      8:        char *v;
                      9: #ifdef V10
                     10:        FILE _strbuf;
                     11:        _strbuf._flag = _IOWRT+_IOSTRG;
                     12:        _strbuf._ptr = (unsigned char *) buf;
                     13:        _strbuf._cnt = 100000;
                     14: #define f &_strbuf
                     15: #define sclose(x) buf[n] = 0
                     16: #else
                     17:        FILE *f=sopenw();
                     18:        if(f==NULL)
                     19:                return 0;
                     20:        setvbuf(f, buf, _IOFBF, 100000);
                     21: #endif
                     22:        va_start(args, fmt);
                     23:        n=vfprintf(f, fmt, args);
                     24:        va_end(args);
                     25:        sclose(f);
                     26:        return n;
                     27: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.