[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] seq -0.1 0.1 2: print 2.0 also when locale's decimal point is ",
From: |
Jim Meyering |
Subject: |
[PATCH] seq -0.1 0.1 2: print 2.0 also when locale's decimal point is ", " |
Date: |
Thu, 25 Sep 2008 23:02:22 +0200 |
I looked into this bug:
http://bugzilla.redhat.com/463556
and wrote the patch below.
I'll push it soon, probably tomorrow, after a test case.
>From 7af128badd1b42b7cb0140f7c9cfaa04f8e2a0dc Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 25 Sep 2008 20:01:24 +0200
Subject: [PATCH] seq -0.1 0.1 2: print 2.0 also when locale's decimal point is
","
* src/seq.c (print_numbers): Use strtold, not c_strtold to convert
from just-formatted-using-asprintf string back to double, since
asprintf may have used something other than "." as the decimal point.
Reported by address@hidden as <http://bugzilla.redhat.com/463556>.
$ LC_ALL=cs_CZ.UTF-8 seq -0.1 0.1 2|grep 2.0
[Exit 1]
$ seq -0.1 0.1 2|grep 2.0
2.0
---
src/seq.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/seq.c b/src/seq.c
index 55518df..b5f0651 100644
--- a/src/seq.c
+++ b/src/seq.c
@@ -306,7 +306,7 @@ print_numbers (char const *fmt, struct layout layout,
xalloc_die ();
x_str[x_strlen - layout.suffix_len] = '\0';
- if (xstrtold (x_str + layout.prefix_len, NULL, &x_val, c_strtold)
+ if (xstrtold (x_str + layout.prefix_len, NULL, &x_val, strtold)
&& abs_rel_diff (x_val, last) < DBL_EPSILON)
{
char *x0_str = NULL;
--
1.6.0.2.307.gc427
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] seq -0.1 0.1 2: print 2.0 also when locale's decimal point is ", ",
Jim Meyering <=