src/xxd/xxd.c |  21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)


# HG changeset patch
# User Vadim Vygonets <[email protected]>
# Date 1384858973 -3600
# Node ID 4011df85ce9dd818746d5624c8490b9f2a567f0f
# Parent  f5e9ce53c1d8e9cfb73fdf3932681262e6be6707
xxd: Change displayed file position width to 8 chars

diff -r f5e9ce53c1d8 -r 4011df85ce9d src/xxd/xxd.c
--- a/src/xxd/xxd.c     Tue Nov 19 12:02:10 2013 +0100
+++ b/src/xxd/xxd.c     Tue Nov 19 12:02:53 2013 +0100
@@ -217,7 +217,7 @@
 
 #define TRY_SEEK       /* attempt to use lseek, or skip forward by reading */
 #define COLS 256       /* change here, if you ever need more columns */
-#define LLEN (11 + (9*COLS-1)/1 + COLS + 2)
+#define LLEN (12 + (9*COLS-1) + COLS + 2)
 
 char hexxa[] = "0123456789abcdef0123456789ABCDEF", *hexx = hexxa;
 
@@ -820,32 +820,33 @@
     {
       if (p == 0)
        {
-         sprintf(l, "%07lx: ", n + seekoff + displayoff);
+         sprintf(l, "%08lx:",
+           ((unsigned long)(n + seekoff + displayoff)) & 0xffffffff);
          for (c = 9; c < LLEN; l[c++] = ' ');
        }
       if (hextype == HEX_NORMAL)
        {
-         l[c = (9 + (grplen * p) / octspergrp)] = hexx[(e >> 4) & 0xf];
-         l[++c]                               = hexx[ e       & 0xf];
+         l[c = (10 + (grplen * p) / octspergrp)] = hexx[(e >> 4) & 0xf];
+         l[++c]                                  = hexx[ e       & 0xf];
        }
       else if (hextype == HEX_LITTLEENDIAN)
        {
          int x = p ^ (octspergrp-1);
-         l[c = (9 + (grplen * x) / octspergrp)] = hexx[(e >> 4) & 0xf];
-         l[++c]                                 = hexx[ e       & 0xf];
+         l[c = (10 + (grplen * x) / octspergrp)] = hexx[(e >> 4) & 0xf];
+         l[++c]                                  = hexx[ e       & 0xf];
        }
       else /* hextype == HEX_BITS */
        {
          int i;
 
-         c = (9 + (grplen * p) / octspergrp) - 1;
+         c = (10 + (grplen * p) / octspergrp) - 1;
          for (i = 7; i >= 0; i--)
            l[++c] = (e & (1 << i)) ? '1' : '0';
        }
       if (ebcdic)
        e = (e < 64) ? '.' : etoa64[e-64];
       /* When changing this update definition of LLEN above. */
-      l[11 + (grplen * cols - 1)/octspergrp + p] =
+      l[12 + (grplen * cols - 1)/octspergrp + p] =
 #ifdef __MVS__
          (e >= 64)
 #else
@@ -857,7 +858,7 @@
       n++;
       if (++p == cols)
        {
-         l[c = (11 + (grplen * cols - 1)/octspergrp + p)] = '\n'; l[++c] = 
'\0';
+         l[c = (12 + (grplen * cols - 1)/octspergrp + p)] = '\n'; l[++c] = 
'\0';
          xxdline(fpo, l, autoskip ? nonzero : 1);
          nonzero = 0;
          p = 0;
@@ -867,7 +868,7 @@
     die(2);
   if (p)
     {
-      l[c = (11 + (grplen * cols - 1)/octspergrp + p)] = '\n'; l[++c] = '\0';
+      l[c = (12 + (grplen * cols - 1)/octspergrp + p)] = '\n'; l[++c] = '\0';
       xxdline(fpo, l, 1);
     }
   else if (autoskip)

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Raspunde prin e-mail lui