75067f4f70
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. |
||
---|---|---|
.. | ||
arpa | ||
protocols | ||
rpc | ||
rpcsvc | ||
_ctype.h | ||
a.out.h | ||
ar.h | ||
assert.h | ||
bitstring.h | ||
complex.h | ||
cpio.h | ||
ctype.h | ||
db.h | ||
dirent.h | ||
dlfcn.h | ||
elf-hints.h | ||
elf.h | ||
err.h | ||
fmtmsg.h | ||
fnmatch.h | ||
fstab.h | ||
fts.h | ||
ftw.h | ||
getopt.h | ||
glob.h | ||
grp.h | ||
hesiod.h | ||
histedit.h | ||
ieeefp.h | ||
ifaddrs.h | ||
inttypes.h | ||
iso646.h | ||
kenv.h | ||
langinfo.h | ||
libgen.h | ||
limits.h | ||
link.h | ||
locale.h | ||
Makefile | ||
malloc.h | ||
memory.h | ||
monetary.h | ||
mpool.h | ||
mqueue.h | ||
ndbm.h | ||
netconfig.h | ||
netdb.h | ||
nl_types.h | ||
nlist.h | ||
nss.h | ||
nsswitch.h | ||
objformat.h | ||
paths.h | ||
printf.h | ||
proc_service.h | ||
pthread_np.h | ||
pthread.h | ||
pwd.h | ||
ranlib.h | ||
readpassphrase.h | ||
regex.h | ||
regexp.h | ||
resolv.h | ||
runetype.h | ||
search.h | ||
setjmp.h | ||
sgtty.h | ||
signal.h | ||
stab.h | ||
stdbool.h | ||
stddef.h | ||
stdio.h | ||
stdlib.h | ||
string.h | ||
stringlist.h | ||
strings.h | ||
sysexits.h | ||
tar.h | ||
tgmath.h | ||
time.h | ||
timeconv.h | ||
timers.h | ||
ttyent.h | ||
ulimit.h | ||
unistd.h | ||
utime.h | ||
utmp.h | ||
uuid.h | ||
varargs.h | ||
vis.h | ||
wchar.h | ||
wctype.h | ||
wordexp.h |