aa4ea83798924bf66c40d72e7fa22ec06b85cd41
[reactos.git] / reactos / lib / string / sscanf.c
1 /**/
2
3 #include <windows.h>
4 #define NTOS_MODE_USER
5 #define _NTSYSTEM_
6 #include <ndk/umtypes.h>
7 #include <ndk/rtlfuncs.h>
8 #include <stdlib.h>
9 #include <stdarg.h>
10 #include <stdio.h>
11
12 /* helper function for *scanf. Returns the value of character c in the
13 * given base, or -1 if the given character is not a digit of the base.
14 */
15 static int char2digit(char c, int base) {
16 if ((c>='0') && (c<='9') && (c<='0'+base-1)) return (c-'0');
17 if (base<=10) return -1;
18 if ((c>='A') && (c<='Z') && (c<='A'+base-11)) return (c-'A'+10);
19 if ((c>='a') && (c<='z') && (c<='a'+base-11)) return (c-'a'+10);
20 return -1;
21 }
22
23 /* vsscanf */
24 #undef WIDE_SCANF
25 #undef CONSOLE
26 #define STRING 1
27 #include "scanf.h"
28
29 int sscanf(const char *str, const char *format, ...)
30 {
31 va_list valist;
32 int res;
33
34 va_start(valist, format);
35 res = vsscanf(str, format, valist);
36 va_end(valist);
37 return res;
38 }
39
40 /*EOF */