summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2013-01-09 12:23:35 +0000
committerPádraig Brady <P@draigBrady.com>2013-01-26 02:35:58 +0000
commit326e5855bc8dd3d0c5b2c0e461c65879d2b5694d (patch)
tree283b502b0acaa235fab9ac8cbaf7ba49b2f32ee4 /src
parentd302aed182d625281fba87aca3cb513882aa967b (diff)
downloadcoreutils-326e5855bc8dd3d0c5b2c0e461c65879d2b5694d.tar.xz
seq: fix misaligment with -w when no precision for start value
* src/seq.c (get_default_format): Also account for the case where '.' is auto added to the start value, which is significant when the number sequence narrows. * tests/misc/seq.pl: Add two new tests for the failing cases. * NEWS: Mention the fix. Fixes http://bugs.gnu.org/13394
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 22e5ec5da..5ad5fad94 100644
--- a/src/seq.c
+++ b/src/seq.c
@@ -336,6 +336,8 @@ get_default_format (operand first, operand step, operand last)
last_width--; /* don't include space for '.' */
if (last.precision == 0 && prec)
last_width++; /* include space for '.' */
+ if (first.precision == 0 && prec)
+ first_width++; /* include space for '.' */
size_t width = MAX (first_width, last_width);
if (width <= INT_MAX)
{