Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update.
	* stdio-common/vfscanf.c: Handle input -- with format %f correctly
	(it's no input error).
	* stdio-common/tstscanf.c: Add test case for format %f with input --.
	* stdio-common/scanf12.c: Correct expected result for first scanf.
  • Loading branch information
Ulrich Drepper committed Jul 22, 2000
1 parent 40c014b commit fcc10ff
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
@@ -1,5 +1,10 @@
2000-07-22 Ulrich Drepper <drepper@redhat.com>

* stdio-common/vfscanf.c: Handle input -- with format %f correctly
(it's no input error).
* stdio-common/tstscanf.c: Add test case for format %f with input --.
* stdio-common/scanf12.c: Correct expected result for first scanf.

* stdio-common/vfprintf.c (process_string_arg): Correct handling
of multibyte character strings in %s format with precision.

Expand Down
2 changes: 1 addition & 1 deletion stdio-common/scanf12.c
Expand Up @@ -7,7 +7,7 @@ main (void)
double d;
int c;

if (scanf ("%lg", &d) != EOF)
if (scanf ("%lg", &d) != 0)
{
printf ("scanf didn't failed\n");
exit (1);
Expand Down
17 changes: 15 additions & 2 deletions stdio-common/tstscanf.c
Expand Up @@ -277,14 +277,27 @@ main (int argc, char **argv)
/* From PR libc/1313 reported by Ben Caradoc-Davies <bmcd@physics.otago.ac.nz>. */
float value;
int res;

res = sscanf ("0123", "%2f", &value);
if (res != 1 || value != 1.0)
{
fputs ("test failed!\n", stdout);
result = 1;
}
}


fputs ("Test 10:\n", stdout);
{
float value;
int res;

res = sscanf ("--", "%f", &value);
if (res != 0)
{
fputs ("test failed!\n", stdout);
result = 1;
}
}

exit (result);
}
6 changes: 3 additions & 3 deletions stdio-common/vfscanf.c
Expand Up @@ -1270,7 +1270,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr)

if (n == 10)
{
/*Have not yet found the digit. */
/* Have not yet found the digit. */
while (++from_level <= to_level)
{
/* Search all ten digits of this level. */
Expand Down Expand Up @@ -1491,7 +1491,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
{
/* This is no valid number. */
ungetc (c, s);
input_error ();
conv_error ();
}
#else
/* Match against the decimal point. At this point
Expand Down Expand Up @@ -1524,7 +1524,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
c = *--cmpp;
}

input_error ();
conv_error ();
}
if (width > 0)
/* +1 because we substract below. */
Expand Down

0 comments on commit fcc10ff

Please sign in to comment.