summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2001-02-17 11:15:30 +0000
committerache <ache@FreeBSD.org>2001-02-17 11:15:30 +0000
commit87ce1ec23751f8c1731f75cb8b12095479aaa5aa (patch)
tree8fc6aac47f6c71969f8830cacd2a212189618804 /lib
parent1a27883a6c8646a8ef893332613c9aa49fc6756f (diff)
downloadFreeBSD-src-87ce1ec23751f8c1731f75cb8b12095479aaa5aa.zip
FreeBSD-src-87ce1ec23751f8c1731f75cb8b12095479aaa5aa.tar.gz
CRNCYSTR: determine '.' too
Diffstat (limited to 'lib')
-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 ef4e0ca..2104073 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;
+ }
}
}
}
OpenPOWER on IntegriCloud