The function to register a new output conversion is register_printf_function
, declared in `printf.h'.
'q'
, it defines the conversion `%q'.
The handler-function is the function called by printf
and friends when this conversion appears in a template string. See Defining the Output Handler, for information about how to define a function to pass as this argument. If you specify a null pointer, any existing handler function for spec is removed.
The arginfo-function is the function called by parse_printf_format
when this conversion appears in a template string. See Parsing a Template String, for information about this.
Normally, you install both functions for a conversion at the same time, but if you are never going to call parse_printf_format
, you do not need to define an arginfo function.
The return value is 0
on success, and -1
on failure (which occurs if spec is out of range).
You can redefine the standard output conversions, but this is probably not a good idea because of the potential for confusion. Library routines written by other people could break if you do this.