This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Extending vfprintf and family


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]