coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[coreutils] [PATCH] sort: fix --debug display with very large offsets


From: Paul Eggert
Subject: [coreutils] [PATCH] sort: fix --debug display with very large offsets
Date: Tue, 27 Jul 2010 11:03:37 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.10) Gecko/20100527 Thunderbird/3.0.5

* src/sort.c (mark_key): Don't assume offset <= INT_MAX.
Make the code a bit clearer when width != 0.
---
 src/sort.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/sort.c b/src/sort.c
index 588bae8..f552d21 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');
     }
 }
-- 
1.7.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]