On 02/14/2011 01:03 AM, erik quanstrom wrote: > that doesn't really work for me. either the kernel should always print > as hex, or the decision should be made for the whole string. the \x > notation requires that any \x be excaped. you potentially need to escape > both " and \. it's a difficult and non-standard quoting scheme for plan 9. > if you think the kernel really needs to be making a decision based on > utf-8/not utf-8 (not 7-bit ascii!), i would think the most standard way > of formatting this would be nil, %.*q or %.*H.
I remembered reading of, and using, the %q format, but %H is new to me. The web version of print(2) doesn’t describe it, so I went to the source. In libc.h I found #pragma varargck type "<" void* #pragma varargck type "[" void* #pragma varargck type "H" void* #pragma varargck type "lH" void* but none of these are in the knownfmt[] array in sys/src/libc/fmt/fmt.c and I don’t see where fmtinstall() is called for them. What do these formats do? --Joel