File:  [Research Unix] / researchv10no / libc / stdio / sprintf.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:35 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Norman

/*
 * pANS stdio -- sprintf
 */
#include "iolib.h"
int sprintf(char *buf, const char *fmt, ...){
	int n;
	va_list args;
	char *v;
#ifdef V10
	FILE _strbuf;
	_strbuf._flag = _IOWRT+_IOSTRG;
	_strbuf._ptr = (unsigned char *) buf;
	_strbuf._cnt = 100000;
#define f &_strbuf
#define sclose(x) buf[n] = 0
#else
	FILE *f=sopenw();
	if(f==NULL)
		return 0;
	setvbuf(f, buf, _IOFBF, 100000);
#endif
	va_start(args, fmt);
	n=vfprintf(f, fmt, args);
	va_end(args);
	sclose(f);
	return n;
}

unix.superglobalmegacorp.com

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