This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Extending vfprintf and family
- From: Ryan Arnold <ryan dot arnold at linaro dot org>
- To: Philip Prindeville <philipp_subx at redfish-solutions dot com>
- Cc: Russ Allbery <eagle at eyrie dot org>, libc-alpha <libc-alpha at sourceware dot org>
- Date: Mon, 18 Aug 2014 20:40:10 -0500
- Subject: Re: Extending vfprintf and family
- Authentication-results: sourceware.org; auth=none
- References: <6B382F29-D813-41AA-ADA1-EDF9EE541704 at redfish-solutions dot com> <87oavm7vws dot fsf at hope dot eyrie dot org> <5A3CB9A1-7A05-4A76-BC7B-5EF3CF16CF3F at redfish-solutions dot com>
On Mon, Aug 18, 2014 at 8:23 PM, Philip Prindeville
<philipp_subx@redfish-solutions.com> wrote:
>
>
> On Aug 14, 2014, at 12:45 PM, Russ Allbery <eagle@eyrie.org> wrote:
>
> > Philip Prindeville <philipp_subx@redfish-solutions.com> writes:
> >
> >> When I was at Cisco in the IOS group, there was a way to register
> >> on-the-fly additional format specifiers that *printf() could then
> >> leverage; some of the formatting helpers were quite sophisticated,
> >> understanding ASN.1 or X.509 certs, etc. Not sure we need to be that
> >> complex, though I wouldnât reject it if it were offered, either.
> >
> > glibc supports exactly this. See:
> >
> > https://www.gnu.org/software/libc/manual/html_node/Customizing-Printf.html#Customizing-Printf
>
>
> Thanks, that was helpful. One thing that I donât think was clear, though, is how the same specifier could handle a uint16_t, uint32_t, or uint64_t value. For instance, for a âQâ specifier:
>
> %hq
> %q
> %llq
>
> as examples. Whatâs a portable way to retrieve a variable-sized scalar argument?
>
> Thanks,
>
> -Philip
>
Hi Philip,
Libvecpf uses these hooks, and perhaps it does something similar to
what you're trying to accomplish:
https://github.com/Libvecpf/libvecpf
--
Ryan S. Arnold
Linaro Toolchain Working Group
www.linaro.org