From: Paul Eggert Date: Tue, 27 Jul 2010 18:01:10 +0000 (-0700) Subject: sort: fix --debug display with very large offsets X-Git-Tag: v8.6~83 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1bf73ebb97b2f20bf3d8b1adba43fc9fbbc335f6;p=thirdparty%2Fcoreutils.git 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. --- diff --git a/src/sort.c b/src/sort.c index 588bae80f6..f552d219f6 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'); } }