summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>2001-02-17 11:15:30 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>2001-02-17 11:15:30 +0000
commit8a8e51d8e85c7a7d2465f24ca6fb4154b3456081 (patch)
tree189670efbbdca8b6f9f5435b7322d8bd9227b646
parente43aa45a69983ff519964888a160d060b581579d (diff)
Notes
-rw-r--r--lib/libc/locale/nl_langinfo.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/lib/libc/locale/nl_langinfo.c b/lib/libc/locale/nl_langinfo.c
index ef4e0ca0f14e..2104073f017a 100644
--- a/lib/libc/locale/nl_langinfo.c
+++ b/lib/libc/locale/nl_langinfo.c
@@ -133,18 +133,24 @@ nl_langinfo(nl_item item) {
ret = "";
cs = (char*) __get_current_monetary_locale()->currency_symbol;
if (*cs != '\0') {
- char psn = '\0';
char pos = localeconv()->p_cs_precedes;
- if (pos < CHAR_MAX && pos == localeconv()->n_cs_precedes)
- psn = pos ? '-' : '+'; /* can't sense '.' */
- if (psn != '\0') {
- int clen = strlen(cs);
+ if (pos == localeconv()->n_cs_precedes) {
+ char psn = '\0';
- if ((csym = reallocf(csym, clen + 2)) != NULL) {
- *csym = psn;
- strcpy(csym + 1, cs);
- ret = csym;
+ if (pos == CHAR_MAX) {
+ if (strcmp(cs, __get_current_monetary_locale()->mon_decimal_point) == 0)
+ psn = '.';
+ } else
+ psn = pos ? '-' : '+';
+ if (psn != '\0') {
+ int clen = strlen(cs);
+
+ if ((csym = reallocf(csym, clen + 2)) != NULL) {
+ *csym = psn;
+ strcpy(csym + 1, cs);
+ ret = csym;
+ }
}
}
}