]> git.sur5r.net Git - cc65/blob - libsrc/common/vsscanf.c
added sleep() implementation
[cc65] / libsrc / common / vsscanf.c
1 /*
2  * vsscanf.c
3  *
4  * (C) Copyright 2002 Ullrich von Bassewitz (uz@cc65.org)
5  *
6  */
7
8
9
10 #include <stdio.h>
11 #include "_scanf.h"
12
13
14
15 /*****************************************************************************/
16 /*                                   Code                                    */
17 /*****************************************************************************/
18
19
20
21 static char get (struct indesc* d)
22 /* Read a character from the input string and return it */
23 {
24     char C;
25     if (C = d->buf[d->ridx]) {
26         /* Increment index only if end not reached */
27         ++d->ridx;
28     }
29     return C;
30 }
31
32
33
34 int vsscanf (const char* str, const char* format, va_list ap)
35 /* Standard C function */
36 {
37     struct indesc id;
38
39     /* Initialize the indesc struct. We leave all fields uninitialized that we
40      * don't need
41      */
42     id.fin  = (infunc) get;
43     id.buf  = (char*) str;
44     id.ridx = 0;
45
46     /* Call the internal function and return the result */
47     return _scanf (&id, format, ap);
48 }
49
50
51