1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00

- Changed the error abort condition for the %s conversion of the

scanf() family. It now matches the abort conditions for all other
  conversions and no longer ignores whether any other parameters were
  converted before. This was a quirk in the older implementation.

- The scanf() family now accepts %E and %G in place of %f and %X in
  place of %x.

- Simplified the common code that fopen(), freopen() and fdopen()
  share and which has to figure out by looking at a file access
  mode specification which parameters should be used.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14762 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2004-11-03 15:35:56 +00:00
parent 3b5a4a32a4
commit 4dd74de299
3 changed files with 61 additions and 66 deletions

View File

@@ -1,5 +1,5 @@
/*
* $Id: stdio_vfscanf.c,v 1.4 2004-10-26 16:25:03 obarthel Exp $
* $Id: stdio_vfscanf.c,v 1.5 2004-11-03 15:35:56 obarthel Exp $
*
* :ts=4
*
@@ -305,9 +305,11 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
break;
/* It's a floating point number. */
case 'f':
case 'e':
case 'E':
case 'f':
case 'g':
case 'G':
conversion_type = 'f';
format++;
@@ -321,6 +323,7 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
case 's': /* string */
case 'u': /* unsigned integer */
case 'x': /* unsigned integer in hexadecimal format */
case 'X': /* unsigned integer in hexadecimal format */
case '%': /* the % character */
case '[': /* a range of characters */
@@ -1307,7 +1310,7 @@ __vfscanf(FILE *stream, const char *format, va_list arg)
/* The conversion is considered to have failed if an EOF was
encountered before any non-whitespace characters could be
converted. We also bail out if we hit an error. */
if(c == EOF && (num_chars_processed == 0 || ferror(stream)))
if(c == EOF && ((num_chars_processed == 0 && num_conversions == 0) || ferror(stream)))
goto out;
}