questions to register_printf_specifier()

Walter Harms wharms@bfs.de
Sun Mar 7 11:18:03 GMT 2021


hi list,
i was playing with register_printf_specifier(). the documentation is sparse,
so i need some help:

I have a working example for a two argument specifier.
(looks like printf("%w\n",arg1,arg2); )

register_printf_specifier('w',usr_printf,usr_arg);

the arginfo function looks like this (reduced version).

int usr_arg (const struct printf_info *info,
             size_t n, int *argtypes,
             int *size)
{
       argtypes[n-1] = PA_STRING;

        *size=2;  // size of user-defined type ?
        return 2; //return the number of need arguments
}

the comment in printf.h say i should fill argtypes. I figured out that n
is the pos in argtypes i have to fill. Begs the questions:

What is the use of *size ? it seems i can set it to any value without any effect.

note: i am not a list member, please always CC

re,
 wh



More information about the Libc-alpha mailing list