This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
[PATCH] fixing a small bug in scanf
- From: Hamed Malek <hamed at bamdad dot org>
- To: libc-alpha <libc-alpha at sources dot redhat dot com>
- Date: Wed, 23 Mar 2005 14:47:27 +0430
- Subject: [PATCH] fixing a small bug in scanf
When decimal-point is more than one byte, scanf fails to recognize
numbers starting with plus or minus sign following decimal-point,
attached is a small patch to fix this up.
Hamed
--- libc/stdio-common/vfscanf.c.orig 2005-03-23 14:37:27.489020006 +0430
+++ libc/stdio-common/vfscanf2.c 2005-03-23 14:37:51.895920909 +0430
@@ -1652,6 +1652,17 @@
conv_error ();
}
+ else
+ {
+ /* We are pushing all read characters back. */
+ while (1)
+ {
+ c = (unsigned char) *--cmpp;
+ if (cmpp == decimal)
+ break;
+ ungetc (c, s);
+ }
+ }
if (width > 0)
width = avail;
#endif