Commit 2e665106444eb32b81e8e94df4b5d8e67723837f

Bruno Haible 2024-02-08T01:09:08

c-nstrftime: New module. Suggested by Paul Eggert. * lib/strftime.h (c_nstrftime): New declaration. * lib/c-nstrftime.c: New file. * lib/strftime.c (FPRINTFTIME): Move fallback definition before its first use. (USE_C_LOCALE): Add fallback definition. If USE_C_LOCALE is set, include c-ctype.h instead of <ctype.h>. Conditionally include <locale.h>. (TOUPPER, TOLOWER): Define differently if USE_C_LOCALE is set. (c_locale_cache, c_locale): New definitions, copied from lib/c-strtod.c. (c_weekday_names, c_month_names): New variables, based on glibc/time/strftime_l.c. (__strftime_internal): Define a_wkday, aw_len, f_wkday, a_month, am_len, f_month, ampm, ap_len differently for USE_C_LOCALE. Avoid a 'goto underlying_strftime' if USE_C_LOCALE && !HAVE_STRFTIME_L. Make the strftime fallback declaration ISO C 23 compliant. If USE_C_LOCALE, use strftime_l() with the C locale object instead of strftime(). * m4/c-nstrftime.m4: New file, based on m4/nstrftime.m4. * modules/c-nstrftime: New file, based on modules/nstrftime.