public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* questions to register_printf_specifier()
@ 2021-03-07 11:18 Walter Harms
  2021-03-08  8:05 ` Florian Weimer
  0 siblings, 1 reply; 3+ messages in thread
From: Walter Harms @ 2021-03-07 11:18 UTC (permalink / raw)
  To: libc-alpha

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-09 16:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-07 11:18 questions to register_printf_specifier() Walter Harms
2021-03-08  8:05 ` Florian Weimer
2021-03-09 16:20   ` AW: " Walter Harms

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).