Working on the ..scanf functions

git-svn-id: svn://svn.cc65.org/cc65/trunk@691 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2001-04-19 06:46:30 +00:00
parent dccc89edae
commit 71e40d42f5
5 changed files with 400 additions and 9 deletions

View File

@@ -19,6 +19,19 @@
static char get (struct indesc* d)
/* Read a character from the input string and return it */
{
char C;
if (C = d->buf[d->ridx]) {
/* Increment index only if end not reached */
++d->ridx;
}
return C;
}
int sscanf (const char* str, const char* format, ...)
/* Standard C function */
{
@@ -28,8 +41,9 @@ int sscanf (const char* str, const char* format, ...)
/* Initialize the indesc struct. We leave all fields uninitialized that we
* don't need
*/
id.fin = (infunc) get;
id.buf = (char*) str;
id.fill = strlen (str);
id.ridx = 0;
/* Setup for variable arguments */
va_start (ap, format);