xref: /original-bsd/lib/libc/stdio/sprintf.c (revision 241757c4)
1 /*
2  * Copyright (c) 1987 Regents of the University of California.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that this notice is preserved and that due credit is given
7  * to the University of California at Berkeley. The name of the University
8  * may not be used to endorse or promote products derived from this
9  * software without specific prior written permission. This software
10  * is provided ``as is'' without express or implied warranty.
11  */
12 
13 #if defined(LIBC_SCCS) && !defined(lint)
14 static char sccsid[] = "@(#)sprintf.c	5.4 (Berkeley) 12/12/87";
15 #endif /* LIBC_SCCS and not lint */
16 
17 #include <stdio.h>
18 
19 sprintf(str, fmt, args)
20 	char *str, *fmt;
21 	int args;
22 {
23 	FILE _strbuf;
24 	int len;
25 
26 	_strbuf._flag = _IOWRT+_IOSTRG;
27 	_strbuf._ptr = str;
28 	_strbuf._cnt = 32767;
29 	len = _doprnt(fmt, &args, &_strbuf);
30 	*_strbuf._ptr = 0;
31 	return(len);
32 }
33