/*
 *			s p r i n t . c
 *
 * Formatted numeric conversion
 */

/*)LIBRARY
*/

#ifdef	DOCUMENTATION

title	sprintf	Formatted Numeric Conversion
index		Formatted Conversion

synopsis
	.s.nf
	char *
	sprintf(buffer, format, arg1, ...);
	char		*buffer;
	char		*format;
	.s.f
Description

	sprintf() converts and formats its arguments, writing the
	result to the indicated string buffer.

	For information on formatting, please refer to the description
	of printf.

	sprintf() returns a pointer to the EOS byte at the end
	of the output buffer.  Note, however, that this feature
	is not transportable to other C implementations.

Bugs

#endif

#include	<stdio.h>

char *
sprint(buffer, format, args)
char		*buffer;
char		*format;
/*
 * Formatted conversion
 */
{
	FILE		dummyiov;
	register FILE	*fd;

	fd = &dummyiov;
	fd->_flag = _IOSTRG | _IOWRT;
	fd->_base = NULL;
	fd->_ptr = buffer;
	fd->_cnt = 32767;
	c_doprnt(format, &args, fd);
	return (fd->_ptr);
}
