xref: /csrg-svn/lib/libc/stdio/scanf.c (revision 22145)
1*22145Smckusick #ifndef lint
2*22145Smckusick static char sccsid[] = "@(#)scanf.c	5.1 (Berkeley) 06/05/85";
3*22145Smckusick #endif not lint
4*22145Smckusick 
52031Swnj #include	<stdio.h>
62031Swnj 
72031Swnj scanf(fmt, args)
82031Swnj char *fmt;
92031Swnj {
102031Swnj 	return(_doscan(stdin, fmt, &args));
112031Swnj }
122031Swnj 
132031Swnj fscanf(iop, fmt, args)
142031Swnj FILE *iop;
152031Swnj char *fmt;
162031Swnj {
172031Swnj 	return(_doscan(iop, fmt, &args));
182031Swnj }
192031Swnj 
202031Swnj sscanf(str, fmt, args)
212031Swnj register char *str;
222031Swnj char *fmt;
232031Swnj {
242031Swnj 	FILE _strbuf;
252031Swnj 
262031Swnj 	_strbuf._flag = _IOREAD|_IOSTRG;
272031Swnj 	_strbuf._ptr = _strbuf._base = str;
282031Swnj 	_strbuf._cnt = 0;
292031Swnj 	while (*str++)
302031Swnj 		_strbuf._cnt++;
318326Smckusick 	_strbuf._bufsiz = _strbuf._cnt;
322031Swnj 	return(_doscan(&_strbuf, fmt, &args));
332031Swnj }
34