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


Hmmmâ Actually, there already is a standard for format specifiers for common network objects, or at least there is in Linux.

https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/lib/vsprintf.c?id=refs/tags/v3.16.1#n1608

It doesnât look like most of this could be implemented using register_printf_*(). It doesnât seem to me that the state machine which parses the format could pick up characters past the actual conversion specifier itself:

   Format of the format string
       The  format  string  is a character string, beginning and ending in its
       initial shift state, if any.  The format string is composed of zero  or
       more   directives:  ordinary  characters  (not  %),  which  are  copied
       unchanged to the output stream; and conversion specifications, each  of
       which results in fetching zero or more subsequent arguments.  Each conâ
       version specification is introduced by the character %, and ends with a
       conversion  specifier.

Looks like libbacktrace would be required, at a minimum.  And the printf_function() would need to be able to peek ahead in the format string and consume extra charactersâ which itâs not able to do.

Looks like it would be easier just to port the vsnprintf code from the Linux kernel. Sigh.

-Philip






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