summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2009-02-14 17:20:37 +0000
committerPádraig Brady <P@draigBrady.com>2009-02-14 23:47:14 +0000
commit5d0b158f4c7b7fa506a9accec511209f68890982 (patch)
tree18f9b22e63228e61a8f4187733afd28b535858a0 /src
parent982504452d60a87632a5a2f11d1be645e06d8346 (diff)
downloadcoreutils-5d0b158f4c7b7fa506a9accec511209f68890982.tar.xz
seq: Fix equal width calculation when '.' added to last number
Issue reported by Samuel Hapák. <http://lists.gnu.org/archive/html/bug-coreutils/2009-02/msg00139.html> * src/seq.c: Account for '.' added to "last" number. * tests/misc/seq: Add corresponding test. * NEWS: Mention the fix.
Diffstat (limited to 'src')
-rw-r--r--src/seq.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/seq.c b/src/seq.c
index 5f9da963b..ecc72f082 100644
--- a/src/seq.c
+++ b/src/seq.c
@@ -317,6 +317,8 @@ get_default_format (operand first, operand step, operand last)
size_t last_width = last.width + (prec - last.precision);
if (last.precision && prec == 0)
last_width--; /* don't include space for '.' */
+ if (last.precision == 0 && prec)
+ last_width++; /* include space for '.' */
size_t width = MAX (first_width, last_width);
if (width <= INT_MAX)
{