Is there a way to use vsnprintf_l? Would it possibly be considered for an addition one day, if missing?
Florian Weimer
fweimer@redhat.com
Tue Oct 20 05:45:14 GMT 2020
* Adhemerval Zanella via Libc-help:
> If the idea is to provide a concise support for printf_l family function,
> I think we should add not only snprintf_l or vsnprintf_l, but rather all the
> stdio functions for both printf *and* scanf along with the wchar_t family
> as well. It means to add support for:
>
> int fprintf_l (FILE *, locale_t, const char *, ...)
> int fscanf_l (FILE * , locale_t, const char *, ...)
> int printf_l (locale_t, const char *, ...)
> int scanf_l (locale_t, const char *, ...)
> int sprintf_l (char *, locale_t, const char * , ...)
> int sscanf_l (const char *, locale_t, const char * , ...)
> int vfprintf_l (FILE *, locale_t, const char * , __va_list)
> int vprintf_l (locale_t, const char *, __va_list)
> int vsprintf_l (char * , locale_t, const char *, __va_list);
> int snprintf_l (char *, size_t, locale_t, const char * , ...)
> int vfscanf_l (FILE * , locale_t, const char * , __va_list)
> int vscanf_l (locale_t, const char *, __va_list)
> int vsnprintf_l (char *, size_t, locale_t, const char *, va_list)
> int vsscanf_l (const char *, locale_t, const char *, va_list);
> int dprintf_l (int, locale_t, const char *, ...)
> int vdprintf_l (int, locale_t, const char *, __va_list)
> int asprintf_l (char **, locale_t, const char *, ...)
> int vasprintf_l (char **, locale_t, const char *, __va_list)
>
> int fwprintf_l (FILE *, locale_t, const wchar_t *, ...)
> int fwscanf_l (FILE * , locale_t, const wchar_t *, ...)
> int wprintf_l (locale_t, const wchar_t *, ...)
> int wscanf_l (locale_t, const wchar_t *, ...)
> int wsprintf_l (char *, locale_t, const wchar_t * , ...)
> int swscanf_l (const char *, locale_t, const wchar_t * , ...)
> int vfwprintf_l (FILE *, locale_t, const wchar_t * , __va_list)
> int vwprintf_l (locale_t, const wchar_t *, __va_list)
> int vswprintf_l (wchar_t * , locale_t, const wchar_t *, __va_list);
> int snwprintf_l (wchar_t *, size_t, locale_t, const wchar_t * , ...)
> int vfwscanf_l (FILE * , locale_t, const wchar_t * , __va_list)
> int vwscanf_l (locale_t, const char *, __va_list)
> int vsnwprintf_l (wchar_t *, size_t, locale_t, const wchar_t *, va_list)
> int vswscanf_l (const wchar_t *, locale_t, const wchar_t *, va_list);
> int dwprintf_l (int, locale_t, const wchar_t *, ...)
> int vdwprintf_l (int, locale_t, const wchar_t *, __va_list)
> int aswprintf_l (wchar_t **, locale_t, const wchar_t *, ...)
> int vaswprintf_l (wchar_t **, locale_t, const wchar_t *, __va_list)
Not sure how you generated this list. swprintf already behaves like
snprintf, so there is no need for a separate “n” variant. A
wide-character version of dprintf seems unlikely to be implemented
anytime soon.
You did not list the fortify variants of these functions.
I would prefer to wait for standardization: it is not quite clear what
should happen if you use fwprintf_l on a wide stream that already uses a
different charset.
Thanks,
Florian
--
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill
More information about the Libc-help
mailing list