/*
 *			s s c a n . c
 *
 * Formatted numeric input
 */

/*)LIBRARY
*/

#ifdef	DOCUMENTATION

title	sscanf	Formatted Numeric Input
index		Formatted input conversion

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

	sscanf() parses the input string, in buf, according to the indicated
	format descriptor, storing the results in the pointer arguments.
	It returns the number of successfully assigned input items.

	See the description of scanf() for further documentation.

Diagnostics

	Sscanf() returns -1 if the end of the input string was detected
	and no data was stored.  It returns -2 if a palpably
	incorrect format, such as "%" is encountered.

Bugs

#endif

#include	<stdio.h>

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

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