This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]