]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
sort: fix --debug display with very large offsets
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 27 Jul 2010 18:01:10 +0000 (11:01 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 27 Jul 2010 18:01:48 +0000 (11:01 -0700)
* src/sort.c (mark_key): Don't assume offset <= INT_MAX.
Make the code a bit clearer when width != 0.

src/sort.c

index 588bae80f614e5892e57df4160e1cdf825c90bae..f552d219f6a7901e282629a6b9d454ce0a59e51a 100644 (file)
@@ -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');
     }
 }