summaryrefslogtreecommitdiffstats
path: root/libc/stdio/scanf.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-07-06 00:20:50 +0000
committerEric Andersen <andersen@codepoet.org>2000-07-06 00:20:50 +0000
commita67c6273255c0357bf1e14ea35005b47c9a94e6c (patch)
tree34bce2531223bbc738b0c4e13fa25aeca2d1d79e /libc/stdio/scanf.c
parent42ee079162ef0aacb93181dcc0df86c9d33f75c5 (diff)
downloaduClibc-alpine-a67c6273255c0357bf1e14ea35005b47c9a94e6c.tar.bz2
uClibc-alpine-a67c6273255c0357bf1e14ea35005b47c9a94e6c.tar.xz
Lots and lots of cleanups.
-Erik
Diffstat (limited to 'libc/stdio/scanf.c')
-rw-r--r--libc/stdio/scanf.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/libc/stdio/scanf.c b/libc/stdio/scanf.c
index 7c5f52183..593e01d25 100644
--- a/libc/stdio/scanf.c
+++ b/libc/stdio/scanf.c
@@ -1,3 +1,5 @@
+#include <stdlib.h>
+#include <unistd.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
@@ -30,27 +32,27 @@ va_dcl
#ifdef L_sscanf
#ifdef __STDC__
-int sscanf(char * sp, const char * fmt, ...)
+int sscanf(const char * sp, const char * fmt, ...)
#else
int sscanf(sp, fmt, va_alist)
-char * sp;
+__const char * sp;
__const char *fmt;
va_dcl
#endif
{
-static FILE string[1] =
-{
- {0, (char*)(unsigned) -1, 0, 0, (char*) (unsigned) -1, -1,
- _IOFBF | __MODE_READ}
-};
-
- va_list ptr;
- int rv;
- va_strt(ptr, fmt);
- string->bufpos = sp;
- rv = vfscanf(string,fmt,ptr);
- va_end(ptr);
- return rv;
+ FILE string[1] =
+ {
+ {0, (char*)(unsigned) -1, 0, 0, (char*) (unsigned) -1, -1,
+ _IOFBF | __MODE_READ}
+ };
+
+ va_list ptr;
+ int rv;
+ va_strt(ptr, fmt);
+ string->bufpos = (unsigned char *)((void*)sp);
+ rv = vfscanf(string,fmt,ptr);
+ va_end(ptr);
+ return rv;
}
#endif
@@ -83,18 +85,16 @@ va_list ap;
#endif
#ifdef L_vsscanf
-int vsscanf(sp, fmt, ap)
-char * sp;
-__const char *fmt;
+int vsscanf(__const char *sp, __const char *fmt, va_list ap)
{
-static FILE string[1] =
-{
- {0, (char*)(unsigned) -1, 0, 0, (char*) (unsigned) -1, -1,
- _IOFBF | __MODE_READ}
-};
-
- string->bufpos = sp;
- return vfscanf(string,fmt,ap);
+ FILE string[1] =
+ {
+ {0, (char*)(unsigned) -1, 0, 0, (char*) (unsigned) -1, -1,
+ _IOFBF | __MODE_READ}
+ };
+
+ string->bufpos = (unsigned char *)((void*)sp);
+ return vfscanf(string,fmt,ap);
}
#endif
@@ -170,7 +170,7 @@ int fp_sval[NSTATE] = {
int
vfscanf(fp, fmt, ap)
register FILE *fp;
-register char *fmt;
+register const char *fmt;
va_list ap;
{