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-09 11:59:49 +0300
committerCorinna Vinschen <corinna@vinschen.de>2010-02-09 11:59:49 +0300
commit502a4f52edea5d8a7ea9d147d12856b5139474bb (patch)
tree1630667b0723b651a168450c87714188060272dd
parent1cea6189a33dafcd77d5668a2a623ed01a4dfe1c (diff)
* lc_msg.h: New file, autogenerated from CLDR data.
* nlsfuncs.cc: Include lc_msg.h. (lc_time_buf): Remove. (lc_numeric_buf): Remove. (lc_monetary_buf): Remove. (lc_mbstowcs): Fix previous fix. (__set_lc_time_from_win): Take additional pointer to buffer pointer, defined in newlib. (__set_lc_numeric_from_win): Ditto. (__set_lc_monetary_from_win): Ditto. (locale_cmp): New static function. (__set_lc_messages_from_win): New function to be called from newlib.
-rw-r--r--winsup/cygwin/ChangeLog15
-rw-r--r--winsup/cygwin/lc_msg.h202
-rw-r--r--winsup/cygwin/nlsfuncs.cc115
3 files changed, 315 insertions, 17 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index fe966c48d..ab8a8d5bc 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,18 @@
+2010-02-09 Corinna Vinschen <corinna@vinschen.de>
+
+ * lc_msg.h: New file, autogenerated from CLDR data.
+ * nlsfuncs.cc: Include lc_msg.h.
+ (lc_time_buf): Remove.
+ (lc_numeric_buf): Remove.
+ (lc_monetary_buf): Remove.
+ (lc_mbstowcs): Fix previous fix.
+ (__set_lc_time_from_win): Take additional pointer to buffer pointer,
+ defined in newlib.
+ (__set_lc_numeric_from_win): Ditto.
+ (__set_lc_monetary_from_win): Ditto.
+ (locale_cmp): New static function.
+ (__set_lc_messages_from_win): New function to be called from newlib.
+
2010-02-08 Corinna Vinschen <corinna@vinschen.de>
* external.cc (cygwin_internal): Add CW_INT_SETLOCALE case to
diff --git a/winsup/cygwin/lc_msg.h b/winsup/cygwin/lc_msg.h
new file mode 100644
index 000000000..90fef322f
--- /dev/null
+++ b/winsup/cygwin/lc_msg.h
@@ -0,0 +1,202 @@
+/* This struct of LC_MESSAGES data has been automatically generated from
+ CLDR locale data on 2010-02-08.
+
+ UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
+
+ Unicode Data Files include all data files under the directories
+ http://www.unicode.org/Public/, http://www.unicode.org/reports/, and
+ http://www.unicode.org/cldr/data/ . Unicode Software includes any
+ source code published in the Unicode Standard or under the
+ directories http://www.unicode.org/Public/,
+ http://www.unicode.org/reports/, and
+ http://www.unicode.org/cldr/data/.
+
+ NOTICE TO USER: Carefully read the following legal agreement. BY
+ DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S
+ DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), YOU
+ UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE TERMS AND
+ CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT DOWNLOAD,
+ INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE.
+
+ COPYRIGHT AND PERMISSION NOTICE
+
+ Copyright © 1991-2010 Unicode, Inc. All rights reserved. Distributed
+ under the Terms of Use in http://www.unicode.org/copyright.html.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of the Unicode data files and any associated
+ documentation (the "Data Files") or Unicode software and any
+ associated documentation (the "Software") to deal in the Data Files
+ or Software without restriction, including without limitation the
+ rights to use, copy, modify, merge, publish, distribute, and/or sell
+ copies of the Data Files or Software, and to permit persons to whom
+ the Data Files or Software are furnished to do so, provided that (a)
+ the above copyright notice(s) and this permission notice appear with
+ all copies of the Data Files or Software, (b) both the above
+ copyright notice(s) and this permission notice appear in associated
+ documentation, and (c) there is clear notice in each modified Data
+ File or in the Software as well as in the documentation associated
+ with the Data File(s) or Software that the data or software has been
+ modified.
+
+ THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY
+ OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE
+ COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR
+ ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY
+ DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ OF THE DATA FILES OR SOFTWARE.
+
+ Except as contained in this notice, the name of a copyright holder
+ shall not be used in advertising or otherwise to promote the sale,
+ use or other dealings in these Data Files or Software without prior
+ written authorization of the copyright holder.
+
+ Unicode and the Unicode logo are trademarks of Unicode, Inc., and
+ may be registered in some jurisdictions. All other trademarks and
+ registered trademarks mentioned herein are the property of their
+ respective owners. */
+
+struct lc_msg_t
+{
+ const char *locale;
+ const wchar_t *yesexpr;
+ const wchar_t *noexpr;
+ const wchar_t *yesstr;
+ const wchar_t *nostr;
+};
+
+static struct lc_msg_t lc_msg[] =
+{
+ { "af_ZA", L"^(([jJ]([aA])?)|([yY]([eE][sS])?))", L"^(([nN]([eE][eE])?)|([nN]([oO])?))", L"ja:j:JA:J:yes:y:YES:Y", L"nee:n:NEE:N:no:n:NO:N" },
+ { "ar_AE", L"^((\x0646\x0639\x0645)|([yY]([eE][sS])?))", L"^((\x0644\x0627)|([nN]([oO])?))", L"\x0646\x0639\x0645:\x0646:yes:y:YES:Y", L"\x0644\x0627:\x0644:no:n:NO:N" },
+ { "ar_BH", L"^((\x0646\x0639\x0645)|([yY]([eE][sS])?))", L"^((\x0644\x0627)|([nN]([oO])?))", L"\x0646\x0639\x0645:\x0646:yes:y:YES:Y", L"\x0644\x0627:\x0644:no:n:NO:N" },
+ { "ar_DZ", L"^((\x0646\x0639\x0645)|([yY]([eE][sS])?))", L"^((\x0644\x0627)|([nN]([oO])?))", L"\x0646\x0639\x0645:\x0646:yes:y:YES:Y", L"\x0644\x0627:\x0644:no:n:NO:N" },
+ { "ar_EG", L"^((\x0646\x0639\x0645)|([yY]([eE][sS])?))", L"^((\x0644\x0627)|([nN]([oO])?))", L"\x0646\x0639\x0645:\x0646:yes:y:YES:Y", L"\x0644\x0627:\x0644:no:n:NO:N" },
+ { "ar_IQ", L"^((\x0646\x0639\x0645)|([yY]([eE][sS])?))", L"^((\x0644\x0627)|([nN]([oO])?))", L"\x0646\x0639\x0645:\x0646:yes:y:YES:Y", L"\x0644\x0627:\x0644:no:n:NO:N" },
+ { "ar_JO", L"^((\x0646\x0639\x0645)|([yY]([eE][sS])?))", L"^((\x0644\x0627)|([nN]([oO])?))", L"\x0646\x0639\x0645:\x0646:yes:y:YES:Y", L"\x0644\x0627:\x0644:no:n:NO:N" },
+ { "ar_KW", L"^((\x0646\x0639\x0645)|([yY]([eE][sS])?))", L"^((\x0644\x0627)|([nN]([oO])?))", L"\x0646\x0639\x0645:\x0646:yes:y:YES:Y", L"\x0644\x0627:\x0644:no:n:NO:N" },
+ { "ar_LB", L"^((\x0646\x0639\x0645)|([yY]([eE][sS])?))", L"^((\x0644\x0627)|([nN]([oO])?))", L"\x0646\x0639\x0645:\x0646:yes:y:YES:Y", L"\x0644\x0627:\x0644:no:n:NO:N" },
+ { "ar_LY", L"^((\x0646\x0639\x0645)|([yY]([eE][sS])?))", L"^((\x0644\x0627)|([nN]([oO])?))", L"\x0646\x0639\x0645:\x0646:yes:y:YES:Y", L"\x0644\x0627:\x0644:no:n:NO:N" },
+ { "ar_MA", L"^((\x0646\x0639\x0645)|([yY]([eE][sS])?))", L"^((\x0644\x0627)|([nN]([oO])?))", L"\x0646\x0639\x0645:\x0646:yes:y:YES:Y", L"\x0644\x0627:\x0644:no:n:NO:N" },
+ { "ar_OM", L"^((\x0646\x0639\x0645)|([yY]([eE][sS])?))", L"^((\x0644\x0627)|([nN]([oO])?))", L"\x0646\x0639\x0645:\x0646:yes:y:YES:Y", L"\x0644\x0627:\x0644:no:n:NO:N" },
+ { "ar_QA", L"^((\x0646\x0639\x0645)|([yY]([eE][sS])?))", L"^((\x0644\x0627)|([nN]([oO])?))", L"\x0646\x0639\x0645:\x0646:yes:y:YES:Y", L"\x0644\x0627:\x0644:no:n:NO:N" },
+ { "ar_SA", L"^((\x0646\x0639\x0645)|([yY]([eE][sS])?))", L"^((\x0644\x0627)|([nN]([oO])?))", L"\x0646\x0639\x0645:\x0646:yes:y:YES:Y", L"\x0644\x0627:\x0644:no:n:NO:N" },
+ { "ar_SD", L"^((\x0646\x0639\x0645)|([yY]([eE][sS])?))", L"^((\x0644\x0627)|([nN]([oO])?))", L"\x0646\x0639\x0645:\x0646:yes:y:YES:Y", L"\x0644\x0627:\x0644:no:n:NO:N" },
+ { "ar_SY", L"^((\x0646\x0639\x0645)|([yY]([eE][sS])?))", L"^((\x0644\x0627)|([nN]([oO])?))", L"\x0646\x0639\x0645:\x0646:yes:y:YES:Y", L"\x0644\x0627:\x0644:no:n:NO:N" },
+ { "ar_TN", L"^((\x0646\x0639\x0645)|([yY]([eE][sS])?))", L"^((\x0644\x0627)|([nN]([oO])?))", L"\x0646\x0639\x0645:\x0646:yes:y:YES:Y", L"\x0644\x0627:\x0644:no:n:NO:N" },
+ { "ar_YE", L"^((\x0646\x0639\x0645)|([yY]([eE][sS])?))", L"^((\x0644\x0627)|([nN]([oO])?))", L"\x0646\x0639\x0645:\x0646:yes:y:YES:Y", L"\x0644\x0627:\x0644:no:n:NO:N" },
+ { "be_BY", L"^(([\x0442\x0422]([\x0430\x0410][\x043a\x041a])?)|([yY]([eE][sS])?))", L"^(([\x043d\x041d]([\x0435\x0415])?)|([nN]([oO])?))", L"\x0442\x0430\x043a:\x0442:\x0422\x0410\x041a:\x0422:yes:y:YES:Y", L"\x043d\x0435:\x043d:\x041d\x0415:\x041d:no:n:NO:N" },
+ { "bg_BG", L"^(([\x0434\x0414]([\x0430\x0410])?)|([yY]([eE][sS])?))", L"^(([\x043d\x041d]([\x0435\x0415])?)|([nN]([oO])?))", L"\x0434\x0430:\x0434:\x0414\x0410:\x0414:yes:y:YES:Y", L"\x043d\x0435:\x043d:\x041d\x0415:\x041d:no:n:NO:N" },
+ { "bn_BD", L"^((\x09b9\x09be\x0981)|([yY]([eE][sS])?))", L"^((\x09a8\x09be)|([nN]([oO])?))", L"\x09b9\x09be\x0981:yes:y:YES:Y", L"\x09a8\x09be:no:n:NO:N" },
+ { "bn_IN", L"^((\x09b9\x09be\x0981)|([yY]([eE][sS])?))", L"^((\x09a8\x09be)|([nN]([oO])?))", L"\x09b9\x09be\x0981:yes:y:YES:Y", L"\x09a8\x09be:no:n:NO:N" },
+ { "bs_BA", L"^(([dD]([aA])?)|([yY]([eE][sS])?))", L"^(([nN]([eE])?)|([nN]([oO])?))", L"da:d:DA:D:yes:y:YES:Y", L"ne:n:NE:N:no:n:NO:N" },
+ { "ca_ES", L"^(([sS]([\x00ed\x00cd])?)|([yY]([eE][sS])?))", L"^(([nN]([oO])?))", L"s\x00ed:s:S\x00cd:S:yes:y:YES:Y", L"no:n:NO:N" },
+ { "cs_CZ", L"^(([aA]([nN][oO])?)|([yY]([eE][sS])?))", L"^(([nN]([eE])?)|([nN]([oO])?))", L"ano:a:ANO:A:yes:y:YES:Y", L"ne:n:NE:N:no:n:NO:N" },
+ { "da_DK", L"^(([jJ]([aA])?)|([yY]([eE][sS])?))", L"^(([nN]([eE][jJ])?)|([nN]([oO])?))", L"ja:j:JA:J:yes:y:YES:Y", L"nej:n:NEJ:N:no:n:NO:N" },
+ { "de_AT", L"^(([jJ]([aA])?)|([yY]([eE][sS])?))", L"^(([nN]([eE][iI][nN])?)|([nN]([oO])?))", L"ja:j:JA:J:yes:y:YES:Y", L"nein:n:NEIN:N:no:n:NO:N" },
+ { "de_BE", L"^(([jJ]([aA])?)|([yY]([eE][sS])?))", L"^(([nN]([eE][iI][nN])?)|([nN]([oO])?))", L"ja:j:JA:J:yes:y:YES:Y", L"nein:n:NEIN:N:no:n:NO:N" },
+ { "de_CH", L"^(([jJ]([aA])?)|([yY]([eE][sS])?))", L"^(([nN]([eE][iI][nN])?)|([nN]([oO])?))", L"ja:j:JA:J:yes:y:YES:Y", L"nein:n:NEIN:N:no:n:NO:N" },
+ { "de_DE", L"^(([jJ]([aA])?)|([yY]([eE][sS])?))", L"^(([nN]([eE][iI][nN])?)|([nN]([oO])?))", L"ja:j:JA:J:yes:y:YES:Y", L"nein:n:NEIN:N:no:n:NO:N" },
+ { "de_LI", L"^(([jJ]([aA])?)|([yY]([eE][sS])?))", L"^(([nN]([eE][iI][nN])?)|([nN]([oO])?))", L"ja:j:JA:J:yes:y:YES:Y", L"nein:n:NEIN:N:no:n:NO:N" },
+ { "de_LU", L"^(([jJ]([aA])?)|([yY]([eE][sS])?))", L"^(([nN]([eE][iI][nN])?)|([nN]([oO])?))", L"ja:j:JA:J:yes:y:YES:Y", L"nein:n:NEIN:N:no:n:NO:N" },
+ { "el_CY", L"^(([\x03bd\x039d]([\x03b1\x0391][\x03b9\x0399])?)|([yY]([eE][sS])?))", L"^(([\x03cc\x038c]([\x03c7\x03a7][\x03b9\x0399])?)|([nN]([oO])?))", L"\x03bd\x03b1\x03b9:\x03bd:\x039d\x0391\x0399:\x039d:yes:y:YES:Y", L"\x03cc\x03c7\x03b9:\x03cc:\x038c\x03a7\x0399:\x038c:no:n:NO:N" },
+ { "el_GR", L"^(([\x03bd\x039d]([\x03b1\x0391][\x03b9\x0399])?)|([yY]([eE][sS])?))", L"^(([\x03cc\x038c]([\x03c7\x03a7][\x03b9\x0399])?)|([nN]([oO])?))", L"\x03bd\x03b1\x03b9:\x03bd:\x039d\x0391\x0399:\x039d:yes:y:YES:Y", L"\x03cc\x03c7\x03b9:\x03cc:\x038c\x03a7\x0399:\x038c:no:n:NO:N" },
+ { "es_AR", L"^(([sS]([\x00ed\x00cd])?)|([sS]([iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO])?))", L"s\x00ed:si:s:S\x00cd:SI:S:yes:y:YES:Y", L"no:n:NO:N" },
+ { "es_BO", L"^(([sS]([\x00ed\x00cd])?)|([sS]([iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO])?))", L"s\x00ed:si:s:S\x00cd:SI:S:yes:y:YES:Y", L"no:n:NO:N" },
+ { "es_CL", L"^(([sS]([\x00ed\x00cd])?)|([sS]([iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO])?))", L"s\x00ed:si:s:S\x00cd:SI:S:yes:y:YES:Y", L"no:n:NO:N" },
+ { "es_CO", L"^(([sS]([\x00ed\x00cd])?)|([sS]([iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO])?))", L"s\x00ed:si:s:S\x00cd:SI:S:yes:y:YES:Y", L"no:n:NO:N" },
+ { "es_CR", L"^(([sS]([\x00ed\x00cd])?)|([sS]([iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO])?))", L"s\x00ed:si:s:S\x00cd:SI:S:yes:y:YES:Y", L"no:n:NO:N" },
+ { "es_DO", L"^(([sS]([\x00ed\x00cd])?)|([sS]([iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO])?))", L"s\x00ed:si:s:S\x00cd:SI:S:yes:y:YES:Y", L"no:n:NO:N" },
+ { "es_EC", L"^(([sS]([\x00ed\x00cd])?)|([sS]([iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO])?))", L"s\x00ed:si:s:S\x00cd:SI:S:yes:y:YES:Y", L"no:n:NO:N" },
+ { "es_ES", L"^(([sS]([\x00ed\x00cd])?)|([sS]([iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO])?))", L"s\x00ed:si:s:S\x00cd:SI:S:yes:y:YES:Y", L"no:n:NO:N" },
+ { "es_GT", L"^(([sS]([\x00ed\x00cd])?)|([sS]([iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO])?))", L"s\x00ed:si:s:S\x00cd:SI:S:yes:y:YES:Y", L"no:n:NO:N" },
+ { "es_HN", L"^(([sS]([\x00ed\x00cd])?)|([sS]([iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO])?))", L"s\x00ed:si:s:S\x00cd:SI:S:yes:y:YES:Y", L"no:n:NO:N" },
+ { "es_MX", L"^(([sS]([\x00ed\x00cd])?)|([sS]([iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO])?))", L"s\x00ed:si:s:S\x00cd:SI:S:yes:y:YES:Y", L"no:n:NO:N" },
+ { "es_NI", L"^(([sS]([\x00ed\x00cd])?)|([sS]([iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO])?))", L"s\x00ed:si:s:S\x00cd:SI:S:yes:y:YES:Y", L"no:n:NO:N" },
+ { "es_PA", L"^(([sS]([\x00ed\x00cd])?)|([sS]([iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO])?))", L"s\x00ed:si:s:S\x00cd:SI:S:yes:y:YES:Y", L"no:n:NO:N" },
+ { "es_PE", L"^(([sS]([\x00ed\x00cd])?)|([sS]([iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO])?))", L"s\x00ed:si:s:S\x00cd:SI:S:yes:y:YES:Y", L"no:n:NO:N" },
+ { "es_PR", L"^(([sS]([\x00ed\x00cd])?)|([sS]([iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO])?))", L"s\x00ed:si:s:S\x00cd:SI:S:yes:y:YES:Y", L"no:n:NO:N" },
+ { "es_PY", L"^(([sS]([\x00ed\x00cd])?)|([sS]([iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO])?))", L"s\x00ed:si:s:S\x00cd:SI:S:yes:y:YES:Y", L"no:n:NO:N" },
+ { "es_SV", L"^(([sS]([\x00ed\x00cd])?)|([sS]([iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO])?))", L"s\x00ed:si:s:S\x00cd:SI:S:yes:y:YES:Y", L"no:n:NO:N" },
+ { "es_US", L"^(([sS]([\x00ed\x00cd])?)|([sS]([iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO])?))", L"s\x00ed:si:s:S\x00cd:SI:S:yes:y:YES:Y", L"no:n:NO:N" },
+ { "es_UY", L"^(([sS]([\x00ed\x00cd])?)|([sS]([iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO])?))", L"s\x00ed:si:s:S\x00cd:SI:S:yes:y:YES:Y", L"no:n:NO:N" },
+ { "es_VE", L"^(([sS]([\x00ed\x00cd])?)|([sS]([iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO])?))", L"s\x00ed:si:s:S\x00cd:SI:S:yes:y:YES:Y", L"no:n:NO:N" },
+ { "et_EE", L"^(([jJ]([aA][hH])?)|([yY]([eE][sS])?))", L"^(([eE]([iI])?)|([nN]([oO])?))", L"jah:j:JAH:J:yes:y:YES:Y", L"ei:e:EI:E:no:n:NO:N" },
+ { "eu_ES", L"^(([bB]([aA][iI])?)|([yY]([eE][sS])?))", L"^(([eE]([zZ])?)|([nN]([oO])?))", L"bai:b:BAI:B:yes:y:YES:Y", L"ez:e:EZ:E:no:n:NO:N" },
+ { "fa_AF", L"^((\x0628\x0644\x0647)|(\x0622\x0631\x06cc)|([yY]([eE][sS])?))", L"^((\x0646\x0647)|(\x062e\x06cc\x0631)|([nN]([oO])?))", L"\x0628\x0644\x0647:\x0628:\x0622\x0631\x06cc:\x0622:yes:y:YES:Y", L"\x0646\x0647:\x0646:\x062e\x06cc\x0631:\x062e:no:n:NO:N" },
+ { "fa_IR", L"^((\x0628\x0644\x0647)|(\x0622\x0631\x06cc)|([yY]([eE][sS])?))", L"^((\x0646\x0647)|(\x062e\x06cc\x0631)|([nN]([oO])?))", L"\x0628\x0644\x0647:\x0628:\x0622\x0631\x06cc:\x0622:yes:y:YES:Y", L"\x0646\x0647:\x0646:\x062e\x06cc\x0631:\x062e:no:n:NO:N" },
+ { "fi_FI", L"^(([kK]([yY][lL][lL][\x00e4\x00c4])?)|([kK]([yY][lL][lL][aA])?)|([yY]([eE][sS])?))", L"^(([eE]([iI])?)|([nN]([oO])?))", L"kyll\x00e4:kylla:k:KYLL\x00c4:KYLLA:K:yes:y:YES:Y", L"ei:e:EI:E:no:n:NO:N" },
+ { "fr_BE", L"^(([oO]([uU][iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO][nN])?)|([nN]([oO])?))", L"oui:o:OUI:O:yes:y:YES:Y", L"non:n:NON:N:no:n:NO:N" },
+ { "fr_CA", L"^(([oO]([uU][iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO][nN])?)|([nN]([oO])?))", L"oui:o:OUI:O:yes:y:YES:Y", L"non:n:NON:N:no:n:NO:N" },
+ { "fr_CH", L"^(([oO]([uU][iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO][nN])?)|([nN]([oO])?))", L"oui:o:OUI:O:yes:y:YES:Y", L"non:n:NON:N:no:n:NO:N" },
+ { "fr_FR", L"^(([oO]([uU][iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO][nN])?)|([nN]([oO])?))", L"oui:o:OUI:O:yes:y:YES:Y", L"non:n:NON:N:no:n:NO:N" },
+ { "fr_LU", L"^(([oO]([uU][iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO][nN])?)|([nN]([oO])?))", L"oui:o:OUI:O:yes:y:YES:Y", L"non:n:NON:N:no:n:NO:N" },
+ { "fr_MC", L"^(([oO]([uU][iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO][nN])?)|([nN]([oO])?))", L"oui:o:OUI:O:yes:y:YES:Y", L"non:n:NON:N:no:n:NO:N" },
+ { "fr_SN", L"^(([oO]([uU][iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO][nN])?)|([nN]([oO])?))", L"oui:o:OUI:O:yes:y:YES:Y", L"non:n:NON:N:no:n:NO:N" },
+ { "gsw_CH", L"^(([jJ]([aA])?)|([yY]([eE][sS])?))", L"^(([nN]([\x00e4\x00c4][iI])?)|([nN]([oO])?))", L"ja:j:JA:J:yes:y:YES:Y", L"n\x00e4i:n:N\x00c4I:N:no:n:NO:N" },
+ { "gu_IN", L"^((\x0ab9\x0abe)|([yY]([eE][sS])?))", L"^((\x0aa8\x0abe)|([nN]([oO])?))", L"\x0ab9\x0abe:yes:y:YES:Y", L"\x0aa8\x0abe:no:n:NO:N" },
+ { "ha_GH@latin", L"^(([yY]([eE][sS])?))", L"^(([aA]'[aA])|([nN]([oO])?))", L"i:I:yes:y:YES:Y", L"a'a:a:A'A:A:no:n:NO:N" },
+ { "ha_NE@latin", L"^(([yY]([eE][sS])?))", L"^(([aA]'[aA])|([nN]([oO])?))", L"i:I:yes:y:YES:Y", L"a'a:a:A'A:A:no:n:NO:N" },
+ { "ha_NG", L"^(([yY]([eE][sS])?))", L"^(([aA]'[aA])|([nN]([oO])?))", L"i:I:yes:y:YES:Y", L"a'a:a:A'A:A:no:n:NO:N" },
+ { "ha_NG@latin", L"^(([yY]([eE][sS])?))", L"^(([aA]'[aA])|([nN]([oO])?))", L"i:I:yes:y:YES:Y", L"a'a:a:A'A:A:no:n:NO:N" },
+ { "ha_SD", L"^(([yY]([eE][sS])?))", L"^(([aA]'[aA])|([nN]([oO])?))", L"i:I:yes:y:YES:Y", L"a'a:a:A'A:A:no:n:NO:N" },
+ { "he_IL", L"^((\x05db\x05df)|([yY]([eE][sS])?))", L"^((\x05dc\x05d0)|([nN]([oO])?))", L"\x05db\x05df:\x05db:yes:y:YES:Y", L"\x05dc\x05d0:\x05dc:no:n:NO:N" },
+ { "hi_IN", L"^((\x0939\x093e\x0901)|([yY]([eE][sS])?))", L"^((\x0928\x0939\x0940\x0902)|([nN]([oO])?))", L"\x0939\x093e\x0901:yes:y:YES:Y", L"\x0928\x0939\x0940\x0902:no:n:NO:N" },
+ { "hr_HR", L"^(([dD]([aA])?)|([yY]([eE][sS])?))", L"^(([nN]([eE])?)|([nN]([oO])?))", L"da:d:DA:D:yes:y:YES:Y", L"ne:n:NE:N:no:n:NO:N" },
+ { "hu_HU", L"^(([iI]([gG][eE][nN])?)|([yY]([eE][sS])?))", L"^(([nN]([eE][mM])?)|([nN]([oO])?))", L"igen:i:IGEN:I:yes:y:YES:Y", L"nem:n:NEM:N:no:n:NO:N" },
+ { "ii_CN", L"^(([yY]([eE][sS])?))", L"^((\xa00b\xa26c)|([nN]([oO])?))", L"\xa26c:yes:y:YES:Y", L"\xa00b\xa26c:no:n:NO:N" },
+ { "it_CH", L"^(([sS]([\x00ec\x00cc])?)|([sS]([iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO])?))", L"s\x00ec:si:s:S\x00cc:SI:S:yes:y:YES:Y", L"no:n:NO:N" },
+ { "it_IT", L"^(([sS]([\x00ec\x00cc])?)|([sS]([iI])?)|([yY]([eE][sS])?))", L"^(([nN]([oO])?))", L"s\x00ec:si:s:S\x00cc:SI:S:yes:y:YES:Y", L"no:n:NO:N" },
+ { "ja_JP", L"^((\x306f\x3044)|(\x30cf\x30a4)|([yY]([eE][sS])?))", L"^((\x3044\x3044\x3048)|(\x30a4\x30a4\x30a8)|([nN]([oO])?))", L"\x306f\x3044:\x30cf\x30a4:yes:y:YES:Y", L"\x3044\x3044\x3048:\x30a4\x30a4\x30a8:no:n:NO:N" },
+ { "kk_KZ", L"^(([\x0438\x0418]([\x04d9\x04d8])?)|([yY]([eE][sS])?))", L"^(([\x0436\x0416]([\x043e\x041e][\x049b\x049a])?)|([nN]([oO])?))", L"\x0438\x04d9:\x0438:\x0418\x04d8:\x0418:yes:y:YES:Y", L"\x0436\x043e\x049b:\x0436:\x0416\x041e\x049a:\x0416:no:n:NO:N" },
+ { "ko_KR", L"^(([yY]([eE][sS])?))", L"^((\xc544\xb2c8\xc624)|([nN]([oO])?))", L"\xc608:yes:y:YES:Y", L"\xc544\xb2c8\xc624:no:n:NO:N" },
+ { "lt_LT", L"^(([tT]([aA][iI][pP])?)|([yY]([eE][sS])?))", L"^(([nN]([eE])?)|([nN]([oO])?))", L"taip:t:TAIP:T:yes:y:YES:Y", L"ne:n:NE:N:no:n:NO:N" },
+ { "lv_LV", L"^(([jJ]([\x0101\x0100])?)|([jJ]([aA])?)|([yY]([eE][sS])?))", L"^(([nN]([\x0113\x0112])?)|([nN]([eE])?)|([nN]([oO])?))", L"j\x0101:ja:j:J\x0100:JA:J:yes:y:YES:Y", L"n\x0113:ne:n:N\x0112:NE:N:no:n:NO:N" },
+ { "mk_MK", L"^(([\x0434\x0414]([\x0430\x0410])?)|([yY]([eE][sS])?))", L"^(([\x043d\x041d]([\x0435\x0415])?)|([nN]([oO])?))", L"\x0434\x0430:\x0434:\x0414\x0410:\x0414:yes:y:YES:Y", L"\x043d\x0435:\x043d:\x041d\x0415:\x041d:no:n:NO:N" },
+ { "ml_IN", L"^((\x0d05\x0d24\x0d46)|([yY]([eE][sS])?))", L"^((\x0d05\x0d32\x0d4d\x0d32)|([nN]([oO])?))", L"\x0d05\x0d24\x0d46:yes:y:YES:Y", L"\x0d05\x0d32\x0d4d\x0d32:no:n:NO:N" },
+ { "mr_IN", L"^((\x0939\x094b\x092f\x0903\x0939\x094b)|([yY]([eE][sS])?))", L"^((\x0928\x093e\x0939\x0940\x0903\x0928\x093e)|([nN]([oO])?))", L"\x0939\x094b\x092f\x0903\x0939\x094b:yes:y:YES:Y", L"\x0928\x093e\x0939\x0940\x0903\x0928\x093e:no:n:NO:N" },
+ { "mt_MT", L"^(([iI]([vV][aA])?)|([yY]([eE][sS])?))", L"^(([lL]([eE])?)|([nN]([oO])?))", L"iva:i:IVA:I:yes:y:YES:Y", L"le:l:LE:L:no:n:NO:N" },
+ { "nb_NO", L"^(([jJ]([aA])?)|([yY]([eE][sS])?))", L"^(([nN]([eE][iI])?)|([nN]([oO])?))", L"ja:JA:yes:y:YES:Y", L"nei:NEI:no:n:NO:N" },
+ { "nl_BE", L"^(([jJ]([aA])?)|([yY]([eE][sS])?))", L"^(([nN]([eE][eE])?)|([nN]([oO])?))", L"ja:j:JA:J:yes:y:YES:Y", L"nee:n:NEE:N:no:n:NO:N" },
+ { "nl_NL", L"^(([jJ]([aA])?)|([yY]([eE][sS])?))", L"^(([nN]([eE][eE])?)|([nN]([oO])?))", L"ja:j:JA:J:yes:y:YES:Y", L"nee:n:NEE:N:no:n:NO:N" },
+ { "nn_NO", L"^(([jJ]([aA])?)|([yY]([eE][sS])?))", L"^(([nN]([eE][iI])?)|([nN]([oO])?))", L"ja:j:JA:J:yes:y:YES:Y", L"nei:n:NEI:N:no:n:NO:N" },
+ { "or_IN", L"^((\x0b39\x0b01)|([yY]([eE][sS])?))", L"^((\x0b28\x0b3e)|([nN]([oO])?))", L"\x0b39\x0b01:yes:y:YES:Y", L"\x0b28\x0b3e:no:n:NO:N" },
+ { "pa_PK", L"^((\x06c1\x0627\x06ba)|([yY]([eE][sS])?))", L"^((\x0646\x06c1\x064a\x06ba)|([nN]([oO])?))", L"\x06c1\x0627\x06ba:yes:y:YES:Y", L"\x0646\x06c1\x064a\x06ba:no:n:NO:N" },
+ { "pl_PL", L"^(([tT]([aA][kK])?)|([yY]([eE][sS])?))", L"^(([nN]([iI][eE])?)|([nN]([oO])?))", L"tak:t:TAK:T:yes:y:YES:Y", L"nie:n:NIE:N:no:n:NO:N" },
+ { "pt_BR", L"^(([sS]([iI][mM])?)|([yY]([eE][sS])?))", L"^(([nN]([\x00e3\x00c3][oO])?)|([nN]([oO])?))", L"sim:s:SIM:S:yes:y:YES:Y", L"n\x00e3o:n:N\x00c3O:N:no:n:NO:N" },
+ { "pt_PT", L"^(([sS]([iI][mM])?)|([yY]([eE][sS])?))", L"^(([nN]([\x00e3\x00c3][oO])?)|([nN]([oO])?))", L"sim:s:SIM:S:yes:y:YES:Y", L"n\x00e3o:n:N\x00c3O:N:no:n:NO:N" },
+ { "ro_MD", L"^(([dD]([aA])?)|([yY]([eE][sS])?))", L"^(([nN]([uU])?)|([nN]([oO])?))", L"da:d:DA:D:yes:y:YES:Y", L"nu:n:NU:N:no:n:NO:N" },
+ { "ro_RO", L"^(([dD]([aA])?)|([yY]([eE][sS])?))", L"^(([nN]([uU])?)|([nN]([oO])?))", L"da:d:DA:D:yes:y:YES:Y", L"nu:n:NU:N:no:n:NO:N" },
+ { "ru_RU", L"^(([\x0434\x0414]([\x0430\x0410])?)|([yY]([eE][sS])?))", L"^(([\x043d\x041d]([\x0435\x0415][\x0442\x0422])?)|([nN]([oO])?))", L"\x0434\x0430:\x0434:\x0414\x0410:\x0414:yes:y:YES:Y", L"\x043d\x0435\x0442:\x043d:\x041d\x0415\x0422:\x041d:no:n:NO:N" },
+ { "ru_UA", L"^(([\x0434\x0414]([\x0430\x0410])?)|([yY]([eE][sS])?))", L"^(([\x043d\x041d]([\x0435\x0415][\x0442\x0422])?)|([nN]([oO])?))", L"\x0434\x0430:\x0434:\x0414\x0410:\x0414:yes:y:YES:Y", L"\x043d\x0435\x0442:\x043d:\x041d\x0415\x0422:\x041d:no:n:NO:N" },
+ { "si_LK", L"^((\x0d94\x0dc0\x0dca)|([yY]([eE][sS])?))", L"^((\x0db1\x0dd0\x0dad)|(\x0db1\x0dd0)|([nN]([oO])?))", L"\x0d94\x0dc0\x0dca:\x0d94:yes:y:YES:Y", L"\x0db1\x0dd0\x0dad:\x0db1\x0dd0:no:n:NO:N" },
+ { "sk_SK", L"^(([aA]([nN][oO])?)|([yY]([eE][sS])?))", L"^(([nN]([iI][eE])?)|([nN]([oO])?))", L"ano:a:ANO:A:yes:y:YES:Y", L"nie:n:NIE:N:no:n:NO:N" },
+ { "sl_SI", L"^(([dD]([aA])?)|([yY]([eE][sS])?))", L"^(([nN]([eE])?)|([nN]([oO])?))", L"da:d:DA:D:yes:y:YES:Y", L"ne:n:NE:N:no:n:NO:N" },
+ { "so_DJ", L"^(([hH]([aA][aA])?)|([yY]([eE][sS])?))", L"^(([mM]([aA][yY][aA])?)|([nN]([oO])?))", L"haa:h:HAA:H:yes:y:YES:Y", L"maya:m:MAYA:M:no:n:NO:N" },
+ { "so_ET", L"^(([hH]([aA][aA])?)|([yY]([eE][sS])?))", L"^(([mM]([aA][yY][aA])?)|([nN]([oO])?))", L"haa:h:HAA:H:yes:y:YES:Y", L"maya:m:MAYA:M:no:n:NO:N" },
+ { "so_KE", L"^(([hH]([aA][aA])?)|([yY]([eE][sS])?))", L"^(([mM]([aA][yY][aA])?)|([nN]([oO])?))", L"haa:h:HAA:H:yes:y:YES:Y", L"maya:m:MAYA:M:no:n:NO:N" },
+ { "so_SO", L"^(([hH]([aA][aA])?)|([yY]([eE][sS])?))", L"^(([mM]([aA][yY][aA])?)|([nN]([oO])?))", L"haa:h:HAA:H:yes:y:YES:Y", L"maya:m:MAYA:M:no:n:NO:N" },
+ { "sq_AL", L"^(([pP]([oO])?)|([yY]([eE][sS])?))", L"^(([jJ]([oO])?)|([nN]([oO])?))", L"po:p:PO:P:yes:y:YES:Y", L"jo:j:JO:J:no:n:NO:N" },
+ { "sr_BA", L"^(([\x0434\x0414]([\x0430\x0410])?)|([yY]([eE][sS])?))", L"^(([\x043d\x041d]([\x0435\x0415])?)|([nN]([oO])?))", L"\x0434\x0430:\x0434:\x0414\x0410:\x0414:yes:y:YES:Y", L"\x043d\x0435:\x043d:\x041d\x0415:\x041d:no:n:NO:N" },
+ { "sr_BA@latin", L"^(([dD]([aA])?)|([yY]([eE][sS])?))", L"^(([nN]([eE])?)|([nN]([oO])?))", L"da:d:DA:D:yes:y:YES:Y", L"ne:n:NE:N:no:n:NO:N" },
+ { "sr_ME", L"^(([\x0434\x0414]([\x0430\x0410])?)|([yY]([eE][sS])?))", L"^(([\x043d\x041d]([\x0435\x0415])?)|([nN]([oO])?))", L"\x0434\x0430:\x0434:\x0414\x0410:\x0414:yes:y:YES:Y", L"\x043d\x0435:\x043d:\x041d\x0415:\x041d:no:n:NO:N" },
+ { "sr_ME@latin", L"^(([dD]([aA])?)|([yY]([eE][sS])?))", L"^(([nN]([eE])?)|([nN]([oO])?))", L"da:d:DA:D:yes:y:YES:Y", L"ne:n:NE:N:no:n:NO:N" },
+ { "sr_RS", L"^(([\x0434\x0414]([\x0430\x0410])?)|([yY]([eE][sS])?))", L"^(([\x043d\x041d]([\x0435\x0415])?)|([nN]([oO])?))", L"\x0434\x0430:\x0434:\x0414\x0410:\x0414:yes:y:YES:Y", L"\x043d\x0435:\x043d:\x041d\x0415:\x041d:no:n:NO:N" },
+ { "sr_RS@latin", L"^(([dD]([aA])?)|([yY]([eE][sS])?))", L"^(([nN]([eE])?)|([nN]([oO])?))", L"da:d:DA:D:yes:y:YES:Y", L"ne:n:NE:N:no:n:NO:N" },
+ { "sv_FI", L"^(([jJ]([aA])?)|([yY]([eE][sS])?))", L"^(([nN]([eE][jJ])?)|([nN]([oO])?))", L"ja:j:JA:J:yes:y:YES:Y", L"nej:n:NEJ:N:no:n:NO:N" },
+ { "sv_SE", L"^(([jJ]([aA])?)|([yY]([eE][sS])?))", L"^(([nN]([eE][jJ])?)|([nN]([oO])?))", L"ja:j:JA:J:yes:y:YES:Y", L"nej:n:NEJ:N:no:n:NO:N" },
+ { "ta_IN", L"^((\x0b86\x0bae\x0bcd)|([yY]([eE][sS])?))", L"^((\x0b87\x0bb2\x0bcd\x0bb2\x0bc8)|([nN]([oO])?))", L"\x0b86\x0bae\x0bcd:\x0b86:yes:y:YES:Y", L"\x0b87\x0bb2\x0bcd\x0bb2\x0bc8:\x0b87:no:n:NO:N" },
+ { "th_TH", L"^((\x0e43\x0e0a\x0e48)|([yY]([eE][sS])?))", L"^((\x0e44\x0e21\x0e48\x0e43\x0e0a\x0e48)|([nN]([oO])?))", L"\x0e43\x0e0a\x0e48:yes:y:YES:Y", L"\x0e44\x0e21\x0e48\x0e43\x0e0a\x0e48:no:n:NO:N" },
+ { "tr_TR", L"^(([eE]([vV][eE][tT])?)|([yY]([eE][sS])?))", L"^(([hH]([aA][yY][\x0131I][rR])?)|([hH]([aA][yY][iI][rR])?)|([nN]([oO])?))", L"evet:e:EVET:E:yes:y:YES:Y", L"hay\x0131r:hayir:h:HAYIR:HAY\x0130R:H:no:n:NO:N" },
+ { "uk_UA", L"^(([\x0442\x0422]([\x0430\x0410][\x043a\x041a])?)|([yY]([eE][sS])?))", L"^(([\x043d\x041d]([\x0456\x0406])?)|([nN]([oO])?))", L"\x0442\x0430\x043a:\x0442:\x0422\x0410\x041a:\x0422:yes:y:YES:Y", L"\x043d\x0456:\x043d:\x041d\x0406:\x041d:no:n:NO:N" },
+ { "zh_CN", L"^((\x786e\x5b9a)|([yY]([eE][sS])?))", L"^((\x5426\x5b9a)|([nN]([oO])?))", L"\x662f:\x786e\x5b9a:yes:y:YES:Y", L"\x5426:\x5426\x5b9a:no:n:NO:N" },
+ { "zh_HK", L"^((\x78ba\x5b9a)|([yY]([eE][sS])?))", L"^((\x5426\x5b9a)|([nN]([oO])?))", L"\x662f:\x78ba\x5b9a:yes:y:YES:Y", L"\x5426:\x5426\x5b9a:no:n:NO:N" },
+ { "zh_MO", L"^((\x78ba\x5b9a)|([yY]([eE][sS])?))", L"^((\x5426\x5b9a)|([nN]([oO])?))", L"\x662f:\x78ba\x5b9a:yes:y:YES:Y", L"\x5426:\x5426\x5b9a:no:n:NO:N" },
+ { "zh_SG", L"^((\x786e\x5b9a)|([yY]([eE][sS])?))", L"^((\x5426\x5b9a)|([nN]([oO])?))", L"\x662f:\x786e\x5b9a:yes:y:YES:Y", L"\x5426:\x5426\x5b9a:no:n:NO:N" },
+ { "zh_TW", L"^((\x78ba\x5b9a)|([yY]([eE][sS])?))", L"^((\x5426\x5b9a)|([nN]([oO])?))", L"\x662f:\x78ba\x5b9a:yes:y:YES:Y", L"\x5426:\x5426\x5b9a:no:n:NO:N" },
+ { "zu_ZA", L"^(([yY]([eE][bB][oO])?)|([yY]([eE][sS])?))", L"^(([cC]([hH][aA])?)|([nN]([oO])?))", L"yebo:y:YEBO:Y:yes:y:YES:Y", L"cha:c:CHA:C:no:n:NO:N" },
+};
diff --git a/winsup/cygwin/nlsfuncs.cc b/winsup/cygwin/nlsfuncs.cc
index e535b1720..4c113f2cd 100644
--- a/winsup/cygwin/nlsfuncs.cc
+++ b/winsup/cygwin/nlsfuncs.cc
@@ -23,10 +23,8 @@ details. */
#include "../locale/timelocal.h"
#include "../locale/lnumeric.h"
#include "../locale/lmonetary.h"
-
-static char *lc_time_buf;
-static char *lc_numeric_buf;
-static char *lc_monetary_buf;
+#include "../locale/lmessages.h"
+#include "lc_msg.h"
#define _LC(x) &lc_##x##_ptr,lc_##x##_end-lc_##x##_ptr
@@ -295,7 +293,7 @@ lc_mbstowcs (mbtowc_p f_mbtowc, const char *charset,
while (n > 0)
{
bytes = f_mbtowc (_REENT, pwcs, t, 6 /* fake, always enough */,
- charset, &state);
+ charset, &state);
if (bytes == (size_t) -1)
{
state.__count = 0;
@@ -465,7 +463,8 @@ conv_grouping (LCID lcid, LCTYPE type, char **lc_ptr)
accessed by functions like nl_langinfo, strftime, strptime. */
extern "C" int
__set_lc_time_from_win (const char *name, struct lc_time_T *_time_locale,
- wctomb_p f_wctomb, const char *charset)
+ char **lc_time_buf, wctomb_p f_wctomb,
+ const char *charset)
{
LCID lcid = __get_lcid_from_locale (name);
if (!lcid || lcid == (LCID) -1)
@@ -527,9 +526,9 @@ __set_lc_time_from_win (const char *name, struct lc_time_T *_time_locale,
free (new_lc_time_buf);
return -1;
}
- if (lc_time_buf)
- free (lc_time_buf);
- lc_time_buf = tmp;
+ if (*lc_time_buf)
+ free (*lc_time_buf);
+ *lc_time_buf = tmp;
return 1;
}
@@ -540,7 +539,8 @@ __set_lc_time_from_win (const char *name, struct lc_time_T *_time_locale,
extern "C" int
__set_lc_numeric_from_win (const char *name,
struct lc_numeric_T *_numeric_locale,
- wctomb_p f_wctomb, const char *charset)
+ char **lc_numeric_buf, wctomb_p f_wctomb,
+ const char *charset)
{
LCID lcid = __get_lcid_from_locale (name);
if (!lcid || lcid == (LCID) -1)
@@ -569,9 +569,9 @@ __set_lc_numeric_from_win (const char *name,
free (new_lc_numeric_buf);
return -1;
}
- if (lc_numeric_buf)
- free (lc_numeric_buf);
- lc_numeric_buf = tmp;
+ if (*lc_numeric_buf)
+ free (*lc_numeric_buf);
+ *lc_numeric_buf = tmp;
return 1;
}
@@ -582,7 +582,8 @@ __set_lc_numeric_from_win (const char *name,
extern "C" int
__set_lc_monetary_from_win (const char *name,
struct lc_monetary_T *_monetary_locale,
- wctomb_p f_wctomb, const char *charset)
+ char **lc_monetary_buf, wctomb_p f_wctomb,
+ const char *charset)
{
LCID lcid = __get_lcid_from_locale (name);
if (!lcid || lcid == (LCID) -1)
@@ -667,9 +668,89 @@ __set_lc_monetary_from_win (const char *name,
free (new_lc_monetary_buf);
return -1;
}
- if (lc_monetary_buf)
- free (lc_monetary_buf);
- lc_monetary_buf = tmp;
+ if (*lc_monetary_buf)
+ free (*lc_monetary_buf);
+ *lc_monetary_buf = tmp;
+ return 1;
+}
+
+static int
+locale_cmp (const void *a, const void *b)
+{
+ struct lc_msg_t *la = (struct lc_msg_t *) a;
+ struct lc_msg_t *lb = (struct lc_msg_t *) b;
+ return strcmp (la->locale, lb->locale);
+}
+
+extern "C" int
+__set_lc_messages_from_win (const char *name,
+ struct lc_messages_T *_messages_locale,
+ char **lc_messages_buf,
+ wctomb_p f_wctomb, const char *charset)
+{
+ LCID lcid = __get_lcid_from_locale (name);
+ if (!lcid || lcid == (LCID) -1)
+ return lcid;
+
+ char locale[ENCODING_LEN + 1];
+ char *c, *c2;
+
+ strcpy (locale, name);
+ /* Removes the charset from the locale and attach the modifer to the
+ language_TERRITORY part. */
+ c = strchr (locale, '.');
+ if (c)
+ {
+ *c = '\0';
+ c2 = strchr (c + 1, '@');
+ /* Ignore @cjknarrow modifier since it's a very personal thing between
+ Cygwin and newlib... */
+ if (c2 && !strcmp (c2, "@cjknarrow"))
+ memmove (c, c2, strlen (c2) + 1);
+ }
+ /* Now search in the alphabetically order lc_msg array for the
+ locale. */
+ lc_msg_t locale_key = { locale, NULL, NULL, NULL, NULL };
+ lc_msg_t *res = (lc_msg_t *) bsearch ((void *) &locale_key, (void *) lc_msg,
+ sizeof lc_msg / sizeof *lc_msg,
+ sizeof *lc_msg, locale_cmp);
+ if (!res)
+ return 0;
+
+ /* Evaluate string length in target charset. */
+ size_t len, total = 0;
+ total += (len = lc_wcstombs (f_wctomb, charset, NULL, res->yesexpr, 0)) + 1;
+ if (len == (size_t) -1)
+ return -1;
+ total += (len = lc_wcstombs (f_wctomb, charset, NULL, res->noexpr, 0)) + 1;
+ if (len == (size_t) -1)
+ return -1;
+ total += (len = lc_wcstombs (f_wctomb, charset, NULL, res->yesstr, 0)) + 1;
+ if (len == (size_t) -1)
+ return -1;
+ total += (len = lc_wcstombs (f_wctomb, charset, NULL, res->nostr, 0)) + 1;
+ if (len == (size_t) -1)
+ return -1;
+ /* Allocate. */
+ char *new_lc_messages_buf = (char *) malloc (total);
+ const char *lc_messages_end = new_lc_messages_buf + total;
+
+ if (!new_lc_messages_buf)
+ return -1;
+ /* Copy over. */
+ c = new_lc_messages_buf;
+ _messages_locale->yesexpr = (const char *) c;
+ len = lc_wcstombs (f_wctomb, charset, c, res->yesexpr, lc_messages_end - c);
+ _messages_locale->noexpr = (const char *) (c += len + 1);
+ len = lc_wcstombs (f_wctomb, charset, c, res->noexpr, lc_messages_end - c);
+ _messages_locale->yesstr = (const char *) (c += len + 1);
+ len = lc_wcstombs (f_wctomb, charset, c, res->yesstr, lc_messages_end - c);
+ _messages_locale->nostr = (const char *) (c += len + 1);
+ lc_wcstombs (f_wctomb, charset, c, res->nostr, lc_messages_end - c);
+ /* Aftermath. */
+ if (*lc_messages_buf)
+ free (*lc_messages_buf);
+ *lc_messages_buf = new_lc_messages_buf;
return 1;
}