Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2010-02-19 20:27:05 +0300
committerCorinna Vinschen <corinna@vinschen.de>2010-02-19 20:27:05 +0300
commitf13fe164754007fc2ce315fd3a3cc336943752b3 (patch)
tree5996b633f85c6e83a4c80b7979f005fa0affb859 /winsup/utils/locale.cc
parent1929fc8ece9cfce99449110b2c78d11473aeebae (diff)
* 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.
Diffstat (limited to 'winsup/utils/locale.cc')
-rw-r--r--winsup/utils/locale.cc38
1 files changed, 36 insertions, 2 deletions
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;