summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/vfscanf.c
Commit message (Collapse)AuthorAgeFilesLines
* Previously, vfscanf()'s wide character processing functions weredas2012-04-291-140/+60
| | | | | | | | | | | | | | | reading wide characters manually. With this change, they now use fgetwc(). To make this work, we use an internal version of fgetwc() with a few extensions: it takes an mbstate * because non-wide streams don't have a built-in mbstate, and it indicates the number of bytes read. vfscanf() now resembles vfwscanf() more closely. Minor functional improvements include working xlocale support in vfscanf(), setting the stream error indicator on encoding errors, and proper handling of shift-based encodings. (Actually, making shift-based encodings work with non-wide streams is hopeless, but the implementation now matches the broken specification.)
* Bugfix: Correctly count the number of characters read for %l[ conversions.das2012-04-221-7/+4
|
* Bugfix: %n doesn't count as a conversion, sodas2012-04-221-1/+0
| | | | sscanf("abc", "ab%ncd", &i) returns EOF, not 0.
* Refactor scanf to improve modularity. Conversions are now performeddas2012-04-221-368/+449
| | | | | | by separate conversion functions. This will hopefully make bugs more noticeable (I noticed several already) and provide opportunities to reduce code duplication.
* Implement xlocale APIs from Darwin, mainly for use by libc++. This adds atheraven2011-11-201-16/+35
| | | | | | | | | | | | load of _l suffixed versions of various standard library functions that use the global locale, making them take an explicit locale parameter. Also adds support for per-thread locales. This work was funded by the FreeBSD Foundation. Please test any code you have that uses the C standard locale functions! Reviewed by: das (gdtoa changes) Approved by: dim (mentor)
* - Add support for multibyte decimal_point encodings, e.g., U+066B.das2009-01-191-14/+32
| | | | | A forthcoming gdtoa import is needed to make this fully work. - Improve the way "nan(...)" is parsed.
* Remove some test instrumentation. (The Symbol.map changes broke it anyway.)das2007-12-091-4/+0
|
* Per Regents of the University of Calfornia letter, remove advertisingimp2007-01-091-4/+0
| | | | | | clause. # If I've done so improperly on a file, please let me know.
* Add missing #if's for NO_FLOATING_POINTphk2006-04-011-0/+2
|
* With current pthread implementations, a mutex initialization willdavidxu2005-12-161-1/+1
| | | | | | | | | | | | allocate a memory block. sscanf calls __svfscanf which in turn calls fread, fread triggers mutex initialization but the mutex is not destroyed in sscanf, this leads to memory leak. To avoid the memory leak and performance issue, we create a none MT-safe version of fread: __fread, and instead let __svfscanf call __fread. PR: threads/90392 Patch submitted by: dhartmei MFC after: 7 days
* Remove unused variable.stefanf2005-04-081-3/+2
|
* - To make it easier to compile *printf() and *scanf() withoutdas2004-05-021-7/+5
| | | | | | | | | floating-point support, remove default definition of FLOATING_POINT from the source, and change the compile-time option to NO_FLOATING_POINT. - Remove the HEXFLOAT option. It saves an insignificant amount of space (<0.1% of the size of libc on i386) and complicates vfprintf() and checkfmt().
* Prepare to handle trivial state-dependent encodings. Full support fortjr2004-04-071-3/+8
| | | | | state-dependent encodings with locking shifts will come later if there is demand for it.
* Fix the handling of negative hexadecimal numbers in integer formats.das2004-01-311-3/+9
| | | | | | | Note that this bug is unrelated to recent work in this area; it seems to have been present since revision 1.1. Obtained from: NetBSD
* Make intentions explicit with additional parenthesis.nectar2004-01-061-4/+4
|
* Pass NULL instead of a pointer to a zeroed mbstate_t object.tjr2003-11-051-7/+3
|
* Revamp scanf's floating-point-parsing algorithm to supportdas2003-06-281-94/+172
| | | | | | | | [+|-]Inf, [+|-]NaN, nan(...), and hexidecimal FP constants. While here, add %a and %A, which are aliases for %e, and add support for long doubles. Reviewed by: standards@
* No need to include floatio.h here: vfscanf() no longer uses anythingtjr2002-11-011-1/+0
| | | | it defines.
* Fix off-by-one error when pushing back a multibyte sequence intjr2002-10-171-2/+6
| | | | wide character class (%l[) and wide string (%ls) conversions.
* Make part of the previous change clearer; check flags for SUPPRESS directlytjr2002-10-171-7/+7
| | | | instead of checking whether we're using a temporary buffer.
* Count field width correctly for suppressed multibyte fields (%*lc,tjr2002-10-161-60/+84
| | | | %*ls, %*l[).
* Set the error bit on the stream if an encoding error occurs. Improvetjr2002-10-161-10/+36
| | | | handling of multibyte sequences representing null wide characters.
* Use a weak reference instead of a macro to make vfscanf an aliastjr2002-10-141-0/+2
| | | | for __vfscanf.
* Implement the %lc, %ls and %[ conversions, which read sequences of widetjr2002-09-231-1/+105
| | | | | characters, non-whitespace wide character strings and wide character strings in a scanset.
* Basic support for wide character I/O: getwc(), fgetwc(), getwchar(),tjr2002-08-131-0/+2
| | | | putwc(), fputwc(), putwchar(), ungetwc(), fwide().
* Assume __STDC__, remove non-__STDC__ code.alfred2002-05-281-4/+0
| | | | Submitted by: keramida
* Implement several of the c99 updates to scanf(3):fenner2002-04-201-64/+85
| | | | | | | | | | | | | - New length modifiers: hh, j, ll, t, z. Still to do: - %C, %S, %lc, %ls (wide character support) - %a/%A (exact hex representation of floating-point numbers) Removed old compatability equivalents: - %D for %ld, %O for %lo, %X for %lx, %E and %F for %le & %lf (these were buggy anyway, since they should have represented %Le & %Lf). - %[unknown uppercase char] for %ld, %[unknown lowercase char] for %d
* Fix the style of the SCM ID's.obrien2002-03-221-4/+2
| | | | I believe have made all of libc .c's as consistent as possible.
* Remove 'register' keyword.obrien2002-03-211-3/+3
|
* Back out national digits support, POSIX explicetely disallows it:ache2001-11-291-53/+55
| | | | | | | | | | | The definition of character class digit requires that only ten characters -the ones defining digits- can be specified; alternate digits (for example, Hindi or Kanji) cannot be specified here. However, the encoding may vary if an implementation supports more than one encoding. The definition of character class xdigit requires that the characters included in character class digit are included here also and allows for different symbols for the hexadecimal digits 10 through 15.
* Don't ever assume that isdigit() is always subset of isxdigit()ache2001-11-281-1/+1
|
* Allow national (non-ASCII) digitsache2001-11-281-55/+53
|
* Use decimal point from localeconv() instead of hardcoded '.' (SUSv2)ache2001-02-101-6/+14
|
* Remove _THREAD_SAFE and make libc thread-safe by default bydeischen2001-01-241-17/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | adding (weak definitions to) stubs for some of the pthread functions. If the threads library is linked in, the real pthread functions will pulled in. Use the following convention for system calls wrapped by the threads library: __sys_foo - actual system call _foo - weak definition to __sys_foo foo - weak definition to __sys_foo Change all libc uses of system calls wrapped by the threads library from foo to _foo. In order to define the prototypes for _foo(), we introduce namespace.h and un-namespace.h (suggested by bde). All files that need to reference these system calls, should include namespace.h before any standard includes, then include un-namespace.h after the standard includes and before any local includes. <db.h> is an exception and shouldn't be included in between namespace.h and un-namespace.h namespace.h will define foo to _foo, and un-namespace.h will undefine foo. Try to eliminate some of the recursive calls to MT-safe functions in libc/stdio in preparation for adding a mutex to FILE. We have recursive mutexes, but would like to avoid using them if possible. Remove uneeded includes of <errno.h> from a few files. Add $FreeBSD$ to a few files in order to pass commitprep. Approved by: -arch
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Apply patch to properly sscanf(3) when there is whitespace in the formatobrien1998-09-251-7/+2
| | | | | | | | | | | | | string. From the submitted patch: Credit for patch: Chris Torek <torek@bsdi.com> Tod Miller <millert@openbsd.org> This makes us in line with SunOS 4.1.3_U1, Solaris 2.6, OpenBSD 2.3, HP-UX 10.20, Irix 5.3. The previous behavior was in line with Ultrix 4.4. PR: bin/7970 Submitted by: Niall Smart nialls@euristix.ie
* Fixed long double formats. They were mostly not implemented exceptbde1997-11-231-4/+7
| | | | | | | | | | | on systems where long doubles are just doubles. FreeBSD hasn't been such a system since it started using gcc-2.5 many years ago. The fix is of low quality. It loses precision. scanf() of long doubles doesn't seem to be used much, but gdb-4.16 uses %Lg format in its expression parser if it thinks that the system supports printf'ing of long doubles. The symptom was that floating point literals were usually interpreted to be 0.0.
* Add 64 bit int support to scanf()jkh1997-07-011-14/+23
| | | | | PR: 2080 Submitted by: David Dawes <dawes@rf900.physics.usyd.edu.au>
* Eliminate yet one function call when locale not usedache1997-04-041-3/+4
|
* Speedup in case locale not usedache1997-04-041-7/+16
|
* Fixed handling of input failure by the scanf family.bde1997-03-031-3/+11
| | | | | | | | | | | - 0 was returned instead of EOF when an input failure occured while skipping white-space after 0 assignments. This fixes PR2606. The diagnosis in PR2606 is wrong. - EOF was returned instead of 0 when an input failure occurred after zero assignments and nonzero suppressed assignments. - EOF was spelled -1. This should be in 2.2.
* Revert $FreeBSD$ to $Id$peter1997-02-221-1/+1
|
* Add XXX comment describing potential memset non-portable issueache1997-02-051-0/+3
| | | | Nitpicked-by: joerg
* Use collate for national [a-z]-like rangesache1997-01-161-8/+13
| | | | Should go in 2.2
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* Suggested by: Bruce Evans, Jeffrey Hsu, Gary Palmerjraynard1996-06-221-4/+9
| | | | | | | | | | | | | | | | | | | | | Added $Id$'s to files that were lacking them (gpalmer), made some cosmetic changes to conform to style guidelines (bde) and checked against NetBSD and Lite2 to remove unnecessary divergences (hsu, bde) One last code cleanup:- Removed spurious casts in fseek.c and stdio.c. Added missing function argument in fwalk.c. Added missing header include in flags.c and rget.c. Put in casts where int's were being passed as size_t's. Put in missing prototypes for static functions. Changed second args of __sflags() inflags.c and writehook() in vasprintf.c from char * to const char * to conform to prototypes. This directory now compiles with no warnings with -Wall under gcc-2.6.3 and with considerably less warnings than before with the ultra-pedantic script I used for testing. (Most of the remaining ones are due to const poisoning).
* Code cleanup:-jraynard1996-06-121-1/+1
| | | | | | | The usual stuff, adding missing function prototypes, argument types, return values, etc. This directory now compiles with no warnings with -Wall on gcc2.6.3!
* BSD 4.4 Lite Lib Sourcesrgrimes1994-05-271-0/+748
OpenPOWER on IntegriCloud