about summary refs log tree commit diff
path: root/stdio-common
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-08-07 04:37:18 +0000
committerUlrich Drepper <drepper@redhat.com>2001-08-07 04:37:18 +0000
commita529b416204403526663696b3dd9fbd567937b9b (patch)
treefc2b87dff24114f728540ff82a5753b745e30f01 /stdio-common
parent70808a9bc6acb22db34258c903678a23e1d9a447 (diff)
downloadglibc-a529b416204403526663696b3dd9fbd567937b9b.tar.gz
glibc-a529b416204403526663696b3dd9fbd567937b9b.tar.xz
glibc-a529b416204403526663696b3dd9fbd567937b9b.zip
Update.
2001-08-06  Jakub Jelinek  <jakub@redhat.com>

	* stdlib/strtod.c (STRTOF): Skip whole infinity, not just inf.
	* stdio-common/vfscanf.c (__vfscanf): +- can be followed by i in +-Inf.

	* stdlib/tst-strtod.c (tests): Add Inf tests.
	* stdio-common/tstscanf.c (main): Add tests for +- before Inf.

	* locale/weightwc.h (findidx): Change type of i to int32_t.
Diffstat (limited to 'stdio-common')
-rw-r--r--stdio-common/tstscanf.c20
-rw-r--r--stdio-common/vfscanf.c2
2 files changed, 21 insertions, 1 deletions
diff --git a/stdio-common/tstscanf.c b/stdio-common/tstscanf.c
index dc02acc4a1..44ddf49e15 100644
--- a/stdio-common/tstscanf.c
+++ b/stdio-common/tstscanf.c
@@ -21,6 +21,7 @@
 #else
 #include <stdio.h>
 #endif
+#include <math.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -331,6 +332,25 @@ main (int argc, char **argv)
       }
   }
 
+  fputs ("Test 13:\n", stdout);
+  {
+    float value;
+    int res;
+
+    res = sscanf ("-InF", "%f", &value);
+    if (res != 1 || isinf (value) != -1)
+      {
+	fputs ("test failed!\n", stdout);
+	result = 1;
+      }
+
+    res = sscanf ("+InfiNiTY", "%f", &value);
+    if (res != 1 || isinf (value) != 1)
+      {
+	fputs ("test failed!\n", stdout);
+	result = 1;
+      }
+  }
 
   return result;
 }
diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
index 9809ea33a8..aa0f091c06 100644
--- a/stdio-common/vfscanf.c
+++ b/stdio-common/vfscanf.c
@@ -1604,7 +1604,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
 	      if (width == 0 || inchar () == EOF)
 		/* EOF is only an input error before we read any chars.  */
 		conv_error ();
-	      if (! ISDIGIT (c))
+	      if (! ISDIGIT (c) && TOLOWER (c) != L_('i'))
 		{
 #ifdef COMPILE_WSCANF
 		  if (c != decimal)