xref: /csrg-svn/lib/libc/stdio/sprintf.c (revision 32989)
1*32989Sbostic /*
2*32989Sbostic  * Copyright (c) 1987 Regents of the University of California.
3*32989Sbostic  * All rights reserved.
4*32989Sbostic  *
5*32989Sbostic  * Redistribution and use in source and binary forms are permitted
6*32989Sbostic  * provided that this notice is preserved and that due credit is given
7*32989Sbostic  * to the University of California at Berkeley. The name of the University
8*32989Sbostic  * may not be used to endorse or promote products derived from this
9*32989Sbostic  * software without specific prior written permission. This software
10*32989Sbostic  * is provided ``as is'' without express or implied warranty.
11*32989Sbostic  */
12*32989Sbostic 
1326663Sdonn #if defined(LIBC_SCCS) && !defined(lint)
14*32989Sbostic static char sccsid[] = "@(#)sprintf.c	5.4 (Berkeley) 12/12/87";
15*32989Sbostic #endif /* LIBC_SCCS and not lint */
1622148Smckusick 
17*32989Sbostic #include <stdio.h>
182033Swnj 
1932532Sbostic sprintf(str, fmt, args)
20*32989Sbostic 	char *str, *fmt;
21*32989Sbostic 	int args;
222033Swnj {
2317951Sserge 	FILE _strbuf;
2432532Sbostic 	int len;
252033Swnj 
262033Swnj 	_strbuf._flag = _IOWRT+_IOSTRG;
272033Swnj 	_strbuf._ptr = str;
282033Swnj 	_strbuf._cnt = 32767;
2932532Sbostic 	len = _doprnt(fmt, &args, &_strbuf);
3032532Sbostic 	*_strbuf._ptr = 0;
3132532Sbostic 	return(len);
322033Swnj }
33