summaryrefslogtreecommitdiff
path: root/lib/libc/stdio
Commit message (Collapse)AuthorAgeFilesLines
* Add missing #if's for NO_FLOATING_POINTPoul-Henning Kamp2006-04-015-4/+16
| | | | Notes: svn path=/head/; revision=157381
* Add __collate_load_error and __collate_range_cmp to the list ofDaniel Eischen2006-03-301-0/+1
| | | | | | | | | | | | | | | | FBSDprivate locale symbols. These functions are needed by libcompat. Add _cleanup to the list of stdio FBSDprivate symbols. Some third party applications use this. This will be removed and replaced by fcloseall() once libc version is bumped. Add _res to the list of resolv symbols. Found by: portbuilder runs (thanks Kris!) Notes: svn path=/head/; revision=157282
* Add each directory's symbol map file to SYM_MAPS.Daniel Eischen2006-03-131-0/+2
| | | | Notes: svn path=/head/; revision=156613
* Add symbol maps and initial symbol version definitions to libc.Daniel Eischen2006-03-131-0/+144
| | | | | | | Reviewed by: davidxu Notes: svn path=/head/; revision=156608
* Fix the %Q printf extension to behave as expectedPoul-Henning Kamp2006-03-021-19/+9
| | | | Notes: svn path=/head/; revision=156207
* Remove spurious "union arg" from printf.hPoul-Henning Kamp2006-02-041-2/+3
| | | | | | | Make sure to always print something in the alternate time format. Notes: svn path=/head/; revision=155300
* Add missing 's' suffix on alternate rendition of time.Poul-Henning Kamp2006-01-311-1/+1
| | | | Notes: svn path=/head/; revision=155085
* Make the %V{is} extension handle a NULL pointer like %s does: output "(null)"Poul-Henning Kamp2006-01-255-1/+187
| | | | | | | | | | | | | | | | Add %M{essage} extension which prints an errno value as the corresponding string if possible or numerically otherwise. It is not currently possible to do the syslog(3) like %m extension because errno would need to get capatured on entry to the first function in the printf family, so %M requires you to supply errno as an argument. Add %Q{uote} extension which will print a string in double quotes with appropriate back-slash escapes (only) if necessary. Notes: svn path=/head/; revision=154815
* Explicitely use a "signed char" instead of a "char", for those archs whereOlivier Houchard2005-12-221-2/+2
| | | | | | | char defaults to unsigned. Notes: svn path=/head/; revision=153641
* Add an extensible version of our *printf(3) implementation to libcPoul-Henning Kamp2005-12-169-0/+2054
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | on probationary terms: it may go away again if it transpires it is a bad idea. This extensible printf version will only be used if either environment variable USE_XPRINTF is defined or one of the extension functions are called. or the global variable __use_xprintf is set greater than zero. In all other cases our traditional printf implementation will be used. The extensible version is slower than the default printf, mostly because less opportunity for combining I/O operation exists when faced with extensions. The default printf on the other hand is a bad case of spaghetti code. The extension API has a GLIBC compatible part and a FreeBSD version of same. The FreeBSD version exists because the GLIBC version may run afoul of our FILE * locking in multithreaded programs and it even further eliminate the opportunities for combining I/O operations. Include three demo extensions which can be enabled if desired: time (%T), hexdump (%H) and strvis (%V). %T can format time_t (%T), struct timeval (%lT) and struct timespec (%llT) in one of two human readable duration formats: "%.3llT" -> "20349.245" "%#.3llT" -> "5h39m9.245" %H will hexdump a sequence of bytes and takes a pointer and a length argument. The width specifies number of bytes per line. "%4H" -> "65 72 20 65" "%+4H" -> "0000 65 72 20 65" "%#4H" -> "65 72 20 65 |er e|" "%+#4H" -> "0000 65 72 20 65 |er e|" %V will dump a string in strvis format. "%V" -> "Hello\tWor\377ld" (C-style) "%0V" -> "Hello\011Wor\377ld" (octal) "%+V" -> "Hello%09Wor%FFld" (http-style) Tests, comments, bugreports etc are most welcome. Notes: svn path=/head/; revision=153486
* With current pthread implementations, a mutex initialization willDavid Xu2005-12-163-9/+19
| | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=153467
* /* You're not supposed to hit this problem */Poul-Henning Kamp2005-12-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For some denormalized long double values, a bug in __hldtoa() (called from *printf()'s %A format) results in a base 16 digit being rounded up from 0xf to 0x10. When this digit is subsequently converted to string format, an index of 10 reaches past the end of the uppper-case hex/char array, picking up whatever the code segment happen to contain at that address. This mostly seem to be some character from the upper half of the byte range. When using the %a format instead of %A, the first character past the end of the lowercase hex/char table happens to be index 0 in the uppercase hex/char table hextable and therefore the string representation features a '0', which is supposedly correct. This leads me to belive that the proper fix _may_ be as simple as masking all but the lower four bits off after incrementing a hex-digit in libc/gdtoa/_hdtoa.c:roundup(). I worry however that the upper bit in 0x10 indicates a carry not carried. Until das@ or bde@ finds time to visit this issue, extend the hexdigit arrays with a 17th index containing '?' so that we get a invalid but consistent and printable output in both %a and %A formats whenever this bug strikes. This unmasks the bug in the %a format therefore solving the real issue may both become easier and more urgent. Possibly related to: PR 85080 With help by: bde@ Notes: svn path=/head/; revision=153375
* Fix prototype.Ruslan Ermilov2005-11-232-2/+2
| | | | Notes: svn path=/head/; revision=152733
* Use the correct function name as .Nm argument.Christian Brueffer2005-09-181-1/+1
| | | | | | | | | PR: 86169 Submitted by: Toby Peterson <toby@apple.com> MFC after: 3 days Notes: svn path=/head/; revision=150291
* Move the declaration of __cleanup to libc_private.h as it is used in bothStefan Farfeleder2005-09-122-2/+3
| | | | | | | stdio/ and stdlib/. Don't define __cleanup twice. Notes: svn path=/head/; revision=150040
* Remove references to nonexistent "FreeBSD Security Architecture" document.Tim J. Robbins2005-09-053-15/+0
| | | | Notes: svn path=/head/; revision=149792
* Include <sys/types.h> and <limits.h> ourselves, don't assume they are includedStefan Farfeleder2005-08-202-0/+2
| | | | | | | | | | | | | through <pthread.h>. gen/sem.c: Prerequisite for <_semaphore.h> net/getprotoent.c: USHRT_MAX net/getservent.c: USHRT_MAX stdio/ungetwc.c: MB_LEN_MAX stdio/vfwscanf.c: MB_LEN_MAX Notes: svn path=/head/; revision=149313
* Speed up __wcsconv() (and hence the printf() %ls format):Tim J. Robbins2005-07-241-34/+30
| | | | | | | | - use wcsrtombs() instead of a wcrtomb() loop where possible. - avoid wcrtomb() loop when output precision is small. Notes: svn path=/head/; revision=148363
* The header glue.h should provide just a declaration for the variableStefan Farfeleder2005-05-131-1/+2
| | | | | | | | | | | __sglue, not a definition. PR: 80378 Submitted by: John Engelhart <johne@zang.com> MFC after: 1 week Notes: svn path=/head/; revision=146197
* The correct description for mode "w" isDag-Erling Smørgrav2005-05-041-1/+1
| | | | | | | | | | | (((truncate to zero length) or (create)) (text file)) (for writing) and not ((truncate file to zero length) or (create text file)) (for writing) MFC after: 1 week Notes: svn path=/head/; revision=145853
* Be bug-for-bug compatible with the C standard with respect toDavid Schultz2005-04-162-4/+16
| | | | | | | printf("%#.0o", 0). Cite an amusing passage from a defect report. Notes: svn path=/head/; revision=145172
* Remove unused variable.Stefan Farfeleder2005-04-081-3/+2
| | | | Notes: svn path=/head/; revision=144814
* Fix EOVERFLOW detection in vswprintf(3)Max Khon2005-02-211-4/+5
| | | | | | | | Reviewed by: tjr MFC after: 2 weeks Notes: svn path=/head/; revision=142183
* Sort sections.Ruslan Ermilov2005-01-203-55/+55
| | | | Notes: svn path=/head/; revision=140505
* Scheduled mdoc(7) sweep.Ruslan Ermilov2005-01-111-1/+3
| | | | Notes: svn path=/head/; revision=140081
* Document that the length modifier l is ignored for floating pointStefan Farfeleder2004-10-161-1/+3
| | | | | | | conversion specifiers (a, A, e, E, f, F, g and G). Notes: svn path=/head/; revision=136592
* Don't add integers to void pointers.Stefan Farfeleder2004-10-031-1/+2
| | | | Notes: svn path=/head/; revision=136092
* Don't forget to va_end() the va_list we get from va_copy().Dag-Erling Smørgrav2004-08-262-0/+2
| | | | | | | | Submitted by: Sean McNeil <sean@mcneil.com> MFC after: 3 days Notes: svn path=/head/; revision=134332
* note that it is the caller's responsibility to free any buffer passedAlfred Perlstein2004-08-241-0/+5
| | | | | | | to setvbuf(3) and friends. Notes: svn path=/head/; revision=134277
* Fix an off-by-one bug that caused the first character of the buffer toTim J. Robbins2004-08-061-2/+1
| | | | | | | be uninitialized. Notes: svn path=/head/; revision=133223
* Read directly from the stdio buffer using the new __mbsnrtowcs() interfaceTim J. Robbins2004-07-211-14/+38
| | | | | | | instead of making repeated calls to __fgetwc(). Notes: svn path=/head/; revision=132498
* Implement the GNU extensions of mbsnrtowcs() and wcsnrtombs(). These areTim J. Robbins2004-07-211-1/+2
| | | | | | | | | | convenient when the source string isn't null-terminated. Implement the other conversion functions (mbstowcs(), mbsrtowcs(), wcstombs(), wcsrtombs()) in terms of these new functions. Notes: svn path=/head/; revision=132497
* Use __wcsrtombs() and __sfvwrite() to convert and write the wide characterTim J. Robbins2004-07-211-8/+25
| | | | | | | string instead of multiple calls to __fputwc(). Notes: svn path=/head/; revision=132491
* Call __mbrtowc() and __wcrtomb() directly instead of taking detoursTim J. Robbins2004-07-203-3/+6
| | | | | | | through mbrtowc() and wcrtomb(). Notes: svn path=/head/; revision=132442
* Add a cross reference to fgetwln(3).Tim J. Robbins2004-07-161-0/+1
| | | | Notes: svn path=/head/; revision=132243
* Add fgetwln(), a wide character version of fgetln().Tim J. Robbins2004-07-163-2/+192
| | | | Notes: svn path=/head/; revision=132242
* Rename slbexpand() to __slbexpand() and make it available outsideTim J. Robbins2004-07-162-4/+5
| | | | | | | of fgetln.c (non-static). Notes: svn path=/head/; revision=132241
* Slightly reorganize and simplify.Tim J. Robbins2004-07-091-24/+11
| | | | Notes: svn path=/head/; revision=131880
* Add commentary explaining why we return EBADF upon attempts to fflush() aColin Percival2004-07-041-0/+12
| | | | | | | | | read-only file. Discussed on: -current Notes: svn path=/head/; revision=131592
* Eliminate double whitespace.Ruslan Ermilov2004-07-031-2/+2
| | | | Notes: svn path=/head/; revision=131539
* Mechanically kill hard sentence breaks.Ruslan Ermilov2004-07-021-4/+8
| | | | Notes: svn path=/head/; revision=131504
* Markup, grammar, and spelling fixes.Ruslan Ermilov2004-06-301-4/+3
| | | | Notes: svn path=/head/; revision=131365
* Spelling fixes.Mike Pritchard2004-06-211-1/+1
| | | | Notes: svn path=/head/; revision=130869
* The third operand of the conditional operator should have type void too.Stefan Farfeleder2004-06-082-2/+2
| | | | | | | Approved by: das (mentor) Notes: svn path=/head/; revision=130242
* Rename cantwrite() to prepwrite(). The latter is less confusing,David Schultz2004-06-081-4/+1
| | | | | | | | | since the macro isn't really a predicate, and it has side-effects. Also, don't set errno if prepwrite() fails, since this is done in prepwrite() now. Notes: svn path=/head/; revision=130232
* Rename cantwrite() to prepwrite(). The latter is less confusing,David Schultz2004-06-084-5/+6
| | | | | | | since the macro isn't really a predicate, and it has side-effects. Notes: svn path=/head/; revision=130231
* Set errno to EBADF on attempts to write to a stream that is notDavid Schultz2004-06-081-2/+5
| | | | | | | | | | | | writable. Affected callers include fwrite(), put?(), and *printf(). The issue of whether this is the right errno for funopened streams is unresolved, but that's an obscure case, and some errno is better than no errno. Discussed with: bde, jkh Notes: svn path=/head/; revision=130230
* Provide trivial macro implementations of getwc(), getwchar(), putwc() andTim J. Robbins2004-05-254-0/+8
| | | | | | | putwchar() to reduce function call overhead. Notes: svn path=/head/; revision=129705
* Perform conversions straight from the stream buffer instead of scanningTim J. Robbins2004-05-221-18/+19
| | | | | | | | | | through byte by byte with mbrtowc(). In the usual case (buffer is big enough to contain the multibyte character, character does not straddle buffer boundary) this results in only one call to mbrtowc() for each wide character read. Notes: svn path=/head/; revision=129584
* Associate a multibyte conversion state object with each stream. Reset itTim J. Robbins2004-05-227-42/+24
| | | | | | | | | | | | to the initial state when a stream is opened or seeked upon. Use the stream's conversion state object instead of a freshly-zeroed one in fgetwc(), fputwc() and ungetwc(). This is only a performance improvement for now, but it would also be required in order to support state-dependent encodings. Notes: svn path=/head/; revision=129583