summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/xprintf.c
Commit message (Collapse)AuthorAgeFilesLines
* The register_printf_render_std() function expects regular string.pjd2012-07-041-1/+1
| | | | | | Change argument type from 'const unsigned char *' to 'const char *'. MFC after: 2 weeks
* - Use an initializer macro to initialize fields in 'fake' FILE objects usedjhb2010-03-111-1/+2
| | | | | | | | | | | | by *sprintf(), etc. - Explicitly initialize _fl_mutex to PTHREAD_MUTEX_INITIALIZER for all FILE objects. This is currently a nop on FreeBSD, but is import for other platforms (or in the future) where PTHREAD_MUTEX_INITIALIZER is not simply zero. PR: threads/141198 Reported by: Jeremy Huddleston @ Apple MFC after: 2 weeks
* Expose FILE's internals to the world again in all their glory. Restorejhb2008-05-051-1/+0
| | | | | all the previous inline optimizations as well. FILE is back to using __mbstate_t, struct pthread *, and struct pthread_mutex *.
* Next round of stdio changes: Remove all inlining of stdio operations andjhb2008-05-021-2/+3
| | | | | | | | | | | | | | | | move the definition of the type backing FILE (struct __sFILE) into an internal header. - Remove macros to inline certain operations from stdio.h. Applications will now always call the functions instead. - Move the various foo_unlocked() functions from unlocked.c into foo.c. This lets some of the inlining macros (e.g. __sfeof()) move into foo.c. - Update a few comments. - struct __sFILE can now go back to using mbstate_t, pthread_t, and pthread_mutex_t instead of knowing about their private, backing types. MFC after: 1 month Reviewed by: kan
* Next stage of stdio cleanup: Retire __sFILEX and merge the fields back intojhb2008-04-171-1/+2
| | | | | | | | | | | | | | | | | | | __sFILE. This was supposed to be done in 6.0. Some notes: - Where possible I restored the various lines to their pre-__sFILEX state. - Retire INITEXTRA() and just initialize the wchar bits (orientation and mbstate) explicitly instead. The various places that used INITEXTRA didn't need the locking fields or _up initialized. (Some places needed _up to exist and not be off the end of a NULL or garbage pointer, but they didn't require it to be initialized to a specific value.) - For now, stdio.h "knows" that pthread_t is a 'struct pthread *' to avoid namespace pollution of including all the pthread types in stdio.h. Once we remove all the inlines and make __sFILE private it can go back to using pthread_t, etc. - This does not remove any of the inlines currently and does not change any of the public ABI of 'FILE'. MFC after: 1 month Reviewed by: peter
* Revert the rev. 1.4, it causes breakage on most arches except i386.kib2006-10-231-4/+1
| | | | | | | | | Remove the const qualifier from ap argument for __v2printf, that induced that breakage, and seems to be the real reason for bad code. ap is modified inside the __v2printf body by va_arg macro. Pointy hat to: kib Approved by: pjd (mentor)
* Workaround for (what seems to be) compiler error for gcc 3.4.6. Onkib2006-10-211-1/+4
| | | | | | | | | | | | | i386 with default optimization level (-O2), va_list pointer ap in the __v2printf function is advanced before the use. That cause argument shift and garbage instead last argument in printf-family when xprintf is activated. The nsswitch is easy victim of the bug. Reviewed by: kan Approved by: kan (mentor) MFC after: 1 week
* Add missing #if's for NO_FLOATING_POINTphk2006-04-011-0/+4
|
* Make the %V{is} extension handle a NULL pointer like %s does: output "(null)"phk2006-01-251-0/+10
| | | | | | | | | | | | | 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.
* Add an extensible version of our *printf(3) implementation to libcphk2005-12-161-0/+674
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.
OpenPOWER on IntegriCloud