From f13fe164754007fc2ce315fd3a3cc336943752b3 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 19 Feb 2010 17:27:05 +0000 Subject: [PATCH] * locale.cc (print_lc_mstrings): New function to print semicolon-separated strings. (enum type_t): New type is_sepstrings_linf. (lc_time_names): Change type of era and alt_digits entry to is_sepstrings_linf. (print_lc): Add case for is_sepstrings_linf and call print_lc_mstrings in that case. --- winsup/utils/ChangeLog | 10 ++++++++++ winsup/utils/locale.cc | 38 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index 4c622207c..345d3c3ea 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -1,3 +1,13 @@ +2010-02-19 Corinna Vinschen + + * locale.cc (print_lc_mstrings): New function to print + semicolon-separated strings. + (enum type_t): New type is_sepstrings_linf. + (lc_time_names): Change type of era and alt_digits entry to + is_sepstrings_linf. + (print_lc): Add case for is_sepstrings_linf and call print_lc_mstrings + in that case. + 2010-02-17 Corinna Vinschen * Makefile.in (CYGWIN_BINS): Rename getlocale to locale. diff --git a/winsup/utils/locale.cc b/winsup/utils/locale.cc index 3691278d7..225ddc4d4 100644 --- a/winsup/utils/locale.cc +++ b/winsup/utils/locale.cc @@ -317,6 +317,36 @@ print_lc_svalue (int key, const char *name, const char *value) fputc ('\n', stdout); } +void +print_lc_sepstrings (int key, const char *name, const char *value) +{ + char *c; + + if (key) + printf ("%s=", name); + while (value && *value) + { + if (key) + fputc ('"', stdout); + c = strchr (value, ';'); + if (!c) + { + fputs (value, stdout); + value = NULL; + } + else + { + printf ("%.*s", c - value, value); + value = c + 1; + } + if (key) + fputc ('"', stdout); + if (value && *value) + fputc (';', stdout); + } + fputc ('\n', stdout); +} + void print_lc_strings (int key, const char *name, int from, int to) { @@ -360,6 +390,7 @@ enum type_t is_grouping_lconv, is_string_linf, is_mstrings_linf, + is_sepstrings_linf, is_mb_cur_max, is_codeset, is_end @@ -413,9 +444,9 @@ lc_names_t lc_time_names[] = { "d_fmt", is_string_linf, D_FMT, 0 }, { "t_fmt", is_string_linf, T_FMT, 0 }, { "t_fmt_ampm", is_string_linf, T_FMT_AMPM, 0 }, - { "era", is_string_linf, ERA, 0 }, + { "era", is_sepstrings_linf,ERA, 0 }, { "era_d_fmt", is_string_linf, ERA_D_FMT, 0 }, - { "alt_digits", is_string_linf, ALT_DIGITS, 0 }, + { "alt_digits", is_sepstrings_linf,ALT_DIGITS, 0 }, { "era_d_t_fmt", is_string_linf, ERA_D_T_FMT, 0 }, { "era_t_fmt", is_string_linf, ERA_T_FMT, 0 }, { "time-codeset", is_codeset, LC_TIME, 0 }, @@ -492,6 +523,9 @@ print_lc (int cat, int key, const char *category, const char *name, case is_string_linf: print_lc_svalue (key, lc->name, nl_langinfo (lc->fromval)); break; + case is_sepstrings_linf: + print_lc_sepstrings (key, lc->name, nl_langinfo (lc->fromval)); + break; case is_mstrings_linf: print_lc_strings (key, lc->name, lc->fromval, lc->toval); break;