* 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
* Re: questions to register_printf_specifier()
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
0 siblings, 1 reply; 3+ messages in thread
From: Florian Weimer @ 2021-03-08 8:05 UTC (permalink / raw)
To: Walter Harms via Libc-alpha; +Cc: Walter Harms
* Walter Harms via Libc-alpha:
> What is the use of *size ? it seems i can set it to any value without
> any effect.
It is the size of the storage needed by the user-defined va_arg
function, registered with register_printf_type. See
stdio-common/tst-vfprintf-user-type.c for an example.
Thanks,
Florian
^ permalink raw reply [flat|nested] 3+ messages in thread
* AW: questions to register_printf_specifier()
2021-03-08 8:05 ` Florian Weimer
@ 2021-03-09 16:20 ` Walter Harms
0 siblings, 0 replies; 3+ messages in thread
From: Walter Harms @ 2021-03-09 16:20 UTC (permalink / raw)
To: Florian Weimer, Walter Harms via Libc-alpha
i will test it.
CU
________________________________________
Von: Florian Weimer <fweimer@redhat.com>
Gesendet: Montag, 8. März 2021 09:05
An: Walter Harms via Libc-alpha
Cc: Walter Harms
Betreff: Re: questions to register_printf_specifier()
* Walter Harms via Libc-alpha:
> What is the use of *size ? it seems i can set it to any value without
> any effect.
It is the size of the storage needed by the user-defined va_arg
function, registered with register_printf_type. See
stdio-common/tst-vfprintf-user-type.c for an example.
Thanks,
Florian
^ 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).