Support printf formats in terminfo strings

terminfo parameterized strings supports a limited subset of printf-style
formatting operations, such as %#5.3d.