summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2004-07-06 09:24:58 +0000
committerAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2004-07-06 09:24:58 +0000
commita72c79567a4f550dfafb532b03be79339c5a4a30 (patch)
tree21fb218cd7200d58d3c339be4e470ef9292c805e
parentbbcc481006d4b5f4e8d1276db2220cf96a355985 (diff)
char. the patch uses strcmp instead of plain char == char operator and allows decimal_point to be of any length. localeconv() is only called if X_LOCALE is _not_ defined
-rw-r--r--math.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/math.c b/math.c
index 913e81f..46ddada 100644
--- a/math.c
+++ b/math.c
@@ -1,7 +1,7 @@
/* $XConsortium: math.c,v 1.17 91/07/25 17:51:34 rws Exp $
* $MIT: contrib/programs/xcalc/math.c,v 3.2 1999/12/14 18:53:00 gjcoram Exp$
* $XFree86: xc/programs/xcalc/math.c,v 1.5tsi Exp $
- * $XdotOrg: $
+ * $XdotOrg: xc/programs/xcalc/math.c,v 1.3 2004/05/23 20:03:49 alanc Exp $
*
* math.c - mathematics functions for a hand calculator under X
*
@@ -400,10 +400,14 @@ bkspf(void)
if (clrdisp)
return;
if ((int) strlen(dispstr) > 0) {
- if (dispstr[strlen(dispstr)-1] == '.')
+#ifndef X_LOCALE
+ const char *dp = localeconv()->decimal_point;
+ size_t dp_len = strlen(dp);
+ size_t ds_len = strlen(dispstr);
+ if (ds_len >= dp_len && strcmp(dispstr + ds_len - dp_len, dp) == 0)
Dpoint=0;
-#ifdef X_LOCALE
- if (dispstr[strlen(dispstr)-1] == localeconv()->decimal_point)
+#else
+ if (dispstr[strlen(dispstr)-1] == '.')
Dpoint=0;
#endif
dispstr[strlen(dispstr)-1] = 0;