diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2010-02-19 17:27:05 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2010-02-19 17:27:05 +0000 |
commit | f13fe164754007fc2ce315fd3a3cc336943752b3 (patch) | |
tree | 5996b633f85c6e83a4c80b7979f005fa0affb859 | |
parent | 1929fc8ece9cfce99449110b2c78d11473aeebae (diff) | |
download | cygnal-f13fe164754007fc2ce315fd3a3cc336943752b3.tar.gz cygnal-f13fe164754007fc2ce315fd3a3cc336943752b3.tar.bz2 cygnal-f13fe164754007fc2ce315fd3a3cc336943752b3.zip |
* 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.
-rw-r--r-- | winsup/utils/ChangeLog | 10 | ||||
-rw-r--r-- | 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 <corinna@vinschen.de> + + * 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 <corinna@vinschen.de> * 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 @@ -318,6 +318,36 @@ print_lc_svalue (int key, const char *name, const char *value) } 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) { if (key) @@ -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; |