14887Schin /***********************************************************************
24887Schin * *
34887Schin * This software is part of the ast package *
4*10898Sroland.mainz@nrubsig.org * Copyright (c) 1986-2009 AT&T Intellectual Property *
54887Schin * and is licensed under the *
64887Schin * Common Public License, Version 1.0 *
78462SApril.Chin@Sun.COM * by AT&T Intellectual Property *
84887Schin * *
94887Schin * A copy of the License is available at *
104887Schin * http://www.opensource.org/licenses/cpl1.0.txt *
114887Schin * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
124887Schin * *
134887Schin * Information and Software Systems Research *
144887Schin * AT&T Research *
154887Schin * Florham Park NJ *
164887Schin * *
174887Schin * Glenn Fowler <gsf@research.att.com> *
184887Schin * *
194887Schin ***********************************************************************/
204887Schin #pragma prototyped
214887Schin /*
224887Schin * Glenn Fowler
234887Schin * AT&T Research
244887Schin *
254887Schin * preprocessor printf using ppputchar() buffering
264887Schin */
274887Schin
284887Schin #include "pplib.h"
294887Schin
304887Schin int
ppprintf(char * format,...)314887Schin ppprintf(char* format, ...)
324887Schin {
334887Schin va_list ap;
344887Schin Sfio_t* sp;
354887Schin
364887Schin if (!(sp = sfnew(NiL, pp.outp, MAXTOKEN, -1, SF_WRITE|SF_STRING)))
374887Schin error(3, "temporary buffer allocation error");
384887Schin va_start(ap, format);
394887Schin sfvprintf(sp, format, ap);
404887Schin va_end(ap);
414887Schin pp.outp += sfseek(sp, 0L, SEEK_CUR);
424887Schin ppcheckout();
434887Schin sfclose(sp);
444887Schin return 0;
454887Schin }
46