summaryrefslogtreecommitdiff
path: root/src/sort.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2010-07-27 11:01:10 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2010-07-27 11:01:48 -0700
commit1bf73ebb97b2f20bf3d8b1adba43fc9fbbc335f6 (patch)
tree9e208928f381e836524c57804d5c37e558bf8897 /src/sort.c
parentc8d3838681de7137a3eb1127c4c4486023bd2f00 (diff)
downloadcoreutils-1bf73ebb97b2f20bf3d8b1adba43fc9fbbc335f6.tar.xz
sort: fix --debug display with very large offsets
* src/sort.c (mark_key): Don't assume offset <= INT_MAX. Make the code a bit clearer when width != 0.
Diffstat (limited to 'src/sort.c')
-rw-r--r--src/sort.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/sort.c b/src/sort.c
index 588bae80f..f552d219f 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -2162,14 +2162,17 @@ count_tabs (char const *text, size_t len)
static void
mark_key (size_t offset, size_t width)
{
- printf ("%*s", (int) offset, "");
+ while (offset--)
+ putchar (' ');
if (!width)
printf (_("^ no match for key\n"));
else
{
- while (width--)
+ do
putchar ('_');
+ while (--width);
+
putchar ('\n');
}
}