Index: display.c
===================================================================
RCS file: /cvs/gnome/gcalctool/gcalctool/display.c,v
retrieving revision 1.34
diff -u -r1.34 display.c
--- display.c	3 Dec 2003 22:20:02 -0000	1.34
+++ display.c	5 Dec 2003 20:40:47 -0000
@@ -55,7 +55,7 @@
             *dstp++ = *srcp--;
             n++;
             if (n == 3 && srcp >= v->fnum) {
-		*dstp++ = ',';
+		*dstp++ = v->tsep_char;
 		n = 0;
             }
 	}
@@ -76,17 +76,33 @@
 
 void
 remove_tsep(char *str) {
+    gboolean found = FALSE;
     char *srcp = str;
     char *dstp = str;
 
+/* If there are no thousands separators in the numeric string, just return
+ * without doing anything. This is needed because the initial constant
+ * definitions are potentially in read-only memory, and shouldn't be adjusted.
+ */
+
     while (*srcp != '\0') {
-        if (*srcp == ',') {
-            srcp++;
-            continue;
+        if (*srcp == v->tsep_char) {
+            found = TRUE;
+        }
+        srcp++;
+    }
+
+    if (found == TRUE) {
+        srcp = str;
+        while (*srcp != '\0') {
+            if (*srcp == v->tsep_char) {
+                srcp++;
+                continue;
+            }
+            *dstp++ = *srcp++;
         }
-        *dstp++ = *srcp++;
+        *dstp++ = '\0';
     }
-    *dstp++ = '\0';
 }
 
 
