Lines 56-61
Link Here
|
56 |
extern char *tzname[]; |
56 |
extern char *tzname[]; |
57 |
#endif |
57 |
#endif |
58 |
|
58 |
|
|
|
59 |
#include <shlib-compat.h> |
60 |
|
59 |
/* Do multibyte processing if multibytes are supported, unless |
61 |
/* Do multibyte processing if multibytes are supported, unless |
60 |
multibyte sequences are safe in formats. Multibyte sequences are |
62 |
multibyte sequences are safe in formats. Multibyte sequences are |
61 |
safe if they cannot contain byte sequences that look like format |
63 |
safe if they cannot contain byte sequences that look like format |
Lines 279-293
static const CHAR_T zeroes[16] = /* "0000000000000000" */
Link Here
|
279 |
function gets as an additional argument the locale which has to be |
281 |
function gets as an additional argument the locale which has to be |
280 |
used. To access the values we have to redefine the _NL_CURRENT |
282 |
used. To access the values we have to redefine the _NL_CURRENT |
281 |
macro. */ |
283 |
macro. */ |
282 |
# define strftime __strftime_l |
284 |
# define strftime __strftime_l_common |
283 |
# define wcsftime __wcsftime_l |
285 |
# define wcsftime __wcsftime_l_common |
284 |
# undef _NL_CURRENT |
286 |
# undef _NL_CURRENT |
285 |
# define _NL_CURRENT(category, item) \ |
287 |
# define _NL_CURRENT(category, item) \ |
286 |
(current->values[_NL_ITEM_INDEX (item)].string) |
288 |
(current->values[_NL_ITEM_INDEX (item)].string) |
|
|
289 |
# define FEATURE_OB_PARAM , int feature_OB |
290 |
# define FEATURE_OB_ARG , feature_OB |
287 |
# define LOCALE_PARAM , __locale_t loc |
291 |
# define LOCALE_PARAM , __locale_t loc |
288 |
# define LOCALE_ARG , loc |
292 |
# define LOCALE_ARG , loc |
289 |
# define HELPER_LOCALE_ARG , current |
293 |
# define HELPER_LOCALE_ARG , current |
290 |
#else |
294 |
#else |
|
|
295 |
# define FEATURE_OB_PARAM |
296 |
# define FEATURE_OB_ARG |
291 |
# define LOCALE_PARAM |
297 |
# define LOCALE_PARAM |
292 |
# define LOCALE_ARG |
298 |
# define LOCALE_ARG |
293 |
# ifdef _LIBC |
299 |
# ifdef _LIBC |
Lines 435-440
static CHAR_T const month_name[][10] =
Link Here
|
435 |
static size_t __strftime_internal (CHAR_T *, size_t, const CHAR_T *, |
441 |
static size_t __strftime_internal (CHAR_T *, size_t, const CHAR_T *, |
436 |
const struct tm *, bool * |
442 |
const struct tm *, bool * |
437 |
ut_argument_spec |
443 |
ut_argument_spec |
|
|
444 |
FEATURE_OB_PARAM |
438 |
LOCALE_PARAM) __THROW; |
445 |
LOCALE_PARAM) __THROW; |
439 |
|
446 |
|
440 |
/* Write information from TP into S according to the format |
447 |
/* Write information from TP into S according to the format |
Lines 446-452
static size_t __strftime_internal (CHAR_T *, size_t, const CHAR_T *,
Link Here
|
446 |
|
453 |
|
447 |
size_t |
454 |
size_t |
448 |
my_strftime (CHAR_T *s, size_t maxsize, const CHAR_T *format, |
455 |
my_strftime (CHAR_T *s, size_t maxsize, const CHAR_T *format, |
449 |
const struct tm *tp ut_argument_spec LOCALE_PARAM) |
456 |
const struct tm *tp ut_argument_spec FEATURE_OB_PARAM LOCALE_PARAM) |
450 |
{ |
457 |
{ |
451 |
#if !defined _LIBC && HAVE_TZNAME && HAVE_TZSET |
458 |
#if !defined _LIBC && HAVE_TZNAME && HAVE_TZSET |
452 |
/* Solaris 2.5 tzset sometimes modifies the storage returned by localtime. |
459 |
/* Solaris 2.5 tzset sometimes modifies the storage returned by localtime. |
Lines 457-463
my_strftime (CHAR_T *s, size_t maxsize, const CHAR_T *format,
Link Here
|
457 |
#endif |
464 |
#endif |
458 |
bool tzset_called = false; |
465 |
bool tzset_called = false; |
459 |
return __strftime_internal (s, maxsize, format, tp, &tzset_called |
466 |
return __strftime_internal (s, maxsize, format, tp, &tzset_called |
460 |
ut_argument LOCALE_ARG); |
467 |
ut_argument FEATURE_OB_ARG LOCALE_ARG); |
461 |
} |
468 |
} |
462 |
#ifdef _LIBC |
469 |
#ifdef _LIBC |
463 |
libc_hidden_def (my_strftime) |
470 |
libc_hidden_def (my_strftime) |
Lines 466-475
libc_hidden_def (my_strftime)
Link Here
|
466 |
static size_t |
473 |
static size_t |
467 |
__strftime_internal (CHAR_T *s, size_t maxsize, const CHAR_T *format, |
474 |
__strftime_internal (CHAR_T *s, size_t maxsize, const CHAR_T *format, |
468 |
const struct tm *tp, bool *tzset_called |
475 |
const struct tm *tp, bool *tzset_called |
469 |
ut_argument_spec LOCALE_PARAM) |
476 |
ut_argument_spec FEATURE_OB_PARAM LOCALE_PARAM) |
470 |
{ |
477 |
{ |
471 |
#if defined _LIBC && defined USE_IN_EXTENDED_LOCALE_MODEL |
478 |
#if defined _LIBC && defined USE_IN_EXTENDED_LOCALE_MODEL |
472 |
struct __locale_data *const current = loc->__locales[LC_TIME]; |
479 |
struct __locale_data *const current = loc->__locales[LC_TIME]; |
|
|
480 |
#else |
481 |
# define feature_OB 1 |
473 |
#endif |
482 |
#endif |
474 |
|
483 |
|
475 |
int hour12 = tp->tm_hour; |
484 |
int hour12 = tp->tm_hour; |
Lines 781-786
__strftime_internal (CHAR_T *s, size_t maxsize, const CHAR_T *format,
Link Here
|
781 |
case L_('B'): |
790 |
case L_('B'): |
782 |
if (modifier == L_('E')) |
791 |
if (modifier == L_('E')) |
783 |
goto bad_format; |
792 |
goto bad_format; |
|
|
793 |
if (!feature_OB && modifier == L_('O')) |
794 |
goto bad_format; |
784 |
if (change_case) |
795 |
if (change_case) |
785 |
{ |
796 |
{ |
786 |
to_uppcase = 1; |
797 |
to_uppcase = 1; |
Lines 788-794
__strftime_internal (CHAR_T *s, size_t maxsize, const CHAR_T *format,
Link Here
|
788 |
} |
799 |
} |
789 |
#if defined _NL_CURRENT || !HAVE_STRFTIME |
800 |
#if defined _NL_CURRENT || !HAVE_STRFTIME |
790 |
/* Use f_altmonth only if f_altmonth is provided. */ |
801 |
/* Use f_altmonth only if f_altmonth is provided. */ |
791 |
if (f_altmonth[0] && modifier == L_('O')) |
802 |
if (f_altmonth[0] && (!feature_OB || modifier == L_('O'))) |
792 |
cpy (STRLEN (f_altmonth), f_altmonth); |
803 |
cpy (STRLEN (f_altmonth), f_altmonth); |
793 |
else |
804 |
else |
794 |
cpy (STRLEN (f_month), f_month); |
805 |
cpy (STRLEN (f_month), f_month); |
Lines 820-829
__strftime_internal (CHAR_T *s, size_t maxsize, const CHAR_T *format,
Link Here
|
820 |
CHAR_T *old_start = p; |
831 |
CHAR_T *old_start = p; |
821 |
size_t len = __strftime_internal (NULL, (size_t) -1, subfmt, |
832 |
size_t len = __strftime_internal (NULL, (size_t) -1, subfmt, |
822 |
tp, tzset_called ut_argument |
833 |
tp, tzset_called ut_argument |
823 |
LOCALE_ARG); |
834 |
FEATURE_OB_ARG LOCALE_ARG); |
824 |
add (len, __strftime_internal (p, maxsize - i, subfmt, |
835 |
add (len, __strftime_internal (p, maxsize - i, subfmt, |
825 |
tp, tzset_called ut_argument |
836 |
tp, tzset_called ut_argument |
826 |
LOCALE_ARG)); |
837 |
FEATURE_OB_ARG LOCALE_ARG)); |
827 |
|
838 |
|
828 |
if (to_uppcase) |
839 |
if (to_uppcase) |
829 |
while (old_start < p) |
840 |
while (old_start < p) |
Lines 1424-1433
size_t
Link Here
|
1424 |
emacs_strftime (char *s, size_t maxsize, const char *format, |
1435 |
emacs_strftime (char *s, size_t maxsize, const char *format, |
1425 |
const struct tm *tp) |
1436 |
const struct tm *tp) |
1426 |
{ |
1437 |
{ |
1427 |
return my_strftime (s, maxsize, format, tp, 0); |
1438 |
return my_strftime (s, maxsize, format, tp, 1, 0); |
1428 |
} |
1439 |
} |
1429 |
#endif |
1440 |
#endif |
1430 |
|
1441 |
|
1431 |
#if defined _LIBC && !defined COMPILE_WIDE |
1442 |
#if defined _LIBC && !defined COMPILE_WIDE |
1432 |
weak_alias (__strftime_l, strftime_l) |
1443 |
size_t |
|
|
1444 |
__strftime_l_internal (char *s, size_t maxsize, const char *format, |
1445 |
const struct tm *tp, __locale_t loc) |
1446 |
{ |
1447 |
return my_strftime (s, maxsize, format, tp, 1, loc); |
1448 |
} |
1449 |
strong_alias (__strftime_l_internal, __strftime_l_internal2) |
1450 |
versioned_symbol (libc, __strftime_l_internal2, __strftime_l, GLIBC_2_25); |
1451 |
libc_hidden_ver (__strftime_l_internal2, __strftime_l) |
1452 |
versioned_symbol (libc, __strftime_l_internal, strftime_l, GLIBC_2_25); |
1453 |
libc_hidden_ver (__strftime_l_internal, strftime_l) |
1454 |
|
1455 |
# if SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_25) |
1456 |
size_t |
1457 |
attribute_compat_text_section |
1458 |
__strftime_l_compat (char *s, size_t maxsize, const char *format, |
1459 |
const struct tm *tp, __locale_t loc) |
1460 |
{ |
1461 |
return my_strftime (s, maxsize, format, tp, 0, loc); |
1462 |
} |
1463 |
strong_alias (__strftime_l_compat, __strftime_l_compat2) |
1464 |
compat_symbol (libc, __strftime_l_compat2, __strftime_l, GLIBC_2_3); |
1465 |
compat_symbol (libc, __strftime_l_compat, strftime_l, GLIBC_2_3); |
1466 |
# endif |
1467 |
|
1433 |
#endif |
1468 |
#endif |