Support printf formats in terminfo strings

Introduce support for terminfo's subset of printf-style formatting on doxXs operations.

r? @thestinger