If you define a meaning for `%q', what if the template contains `%+23q' or `%-#q'? To implement a sensible meaning for these, the handler when called needs to be able to get the options specified in the template.
Both the handler-function and arginfo-function arguments to register_printf_function
accept an argument of type struct printf_info
, which contains information about the options appearing in an instance of the conversion specifier. This data type is declared in the header file `printf.h'.
printf
template string to the handler and arginfo functions for that specifier. It contains the following members:
int prec
-1
if no precision was specified. If the precision was given as `*', the printf_info
structure passed to the handler function contains the actual value retrieved from the argument list. But the structure passed to the arginfo function contains a value of INT_MIN
, since the actual value is not known.
int width
0
if no width was specified. If the field width was given as `*', the printf_info
structure passed to the handler function contains the actual value retrieved from the argument list. But the structure passed to the arginfo function contains a value of INT_MIN
, since the actual value is not known.
char spec
unsigned int is_long_double
unsigned int is_short
unsigned int is_long
unsigned int alt
unsigned int space
unsigned int left
unsigned int showsign
char pad
'0'
if the `0' flag was specified, and ' '
otherwise.