summaryrefslogtreecommitdiff
path: root/builtin.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin.c')
-rw-r--r--builtin.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin.c b/builtin.c
index e1e80152..56334417 100644
--- a/builtin.c
+++ b/builtin.c
@@ -4437,9 +4437,10 @@ add_thousands(const char *original, struct lconv *loc)
if (loc->grouping[ii] && ++jj == loc->grouping[ii]) {
if (src >= original) { /* only add if more digits coming */
const char *ts = loc->thousands_sep;
+ int k;
- while (*ts != '\0')
- *dest++ = *ts++;
+ for (k = strlen(ts) - 1; k >= 0; k--)
+ *dest++ = ts[k];
}
if (loc->grouping[ii+1] == 0)
jj = 0; /* keep using current val in loc.grouping[ii] */