public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Walter Harms <wharms@bfs.de>
To: "libc-alpha@sourceware.org" <libc-alpha@sourceware.org>
Subject: questions to register_printf_specifier()
Date: Sun, 7 Mar 2021 11:18:03 +0000	[thread overview]
Message-ID: <6569e6623ba8441fac499f90ebc6d505@bfs.de> (raw)

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


             reply	other threads:[~2021-03-07 11:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-07 11:18 Walter Harms [this message]
2021-03-08  8:05 ` Florian Weimer
2021-03-09 16:20   ` AW: " Walter Harms

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6569e6623ba8441fac499f90ebc6d505@bfs.de \
    --to=wharms@bfs.de \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).