File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -401,4 +401,18 @@ func Test_xxd_plain_one_line()
401401 endfor
402402endfunc
403403
404+ func Test_xxd_little_endian_with_cols ()
405+ enew !
406+ call writefile ([" ABCDEF" ], ' Xxdin' , ' D' )
407+ exe ' r! ' .. s: xxd_cmd .. ' -e -c6 ' .. ' Xxdin'
408+ call assert_equal (' 00000000: 44434241 4645 ABCDEF' , getline (2 ))
409+
410+ enew !
411+ call writefile ([" ABCDEFGHI" ], ' Xxdin' , ' D' )
412+ exe ' r! ' .. s: xxd_cmd .. ' -e -c9 ' .. ' Xxdin'
413+ call assert_equal (' 00000000: 44434241 48474645 49 ABCDEFGHI' , getline (2 ))
414+
415+ bwipe!
416+ endfunc
417+
404418" vim: shiftwidth = 2 sts = 2 expandtab
Original file line number Diff line number Diff line change @@ -695,6 +695,8 @@ static char *(features[]) =
695695
696696static int included_patches [] =
697697{ /* Add new patch number below this line */
698+ /**/
699+ 1383 ,
698700/**/
699701 1382 ,
700702/**/
Original file line number Diff line number Diff line change @@ -837,7 +837,8 @@ main(int argc, char *argv[])
837837 {
838838 addrlen = sprintf (l , decimal_offset ? "%08ld:" : "%08lx:" ,
839839 ((unsigned long )(n + seekoff + displayoff )));
840- for (c = addrlen ; c < LLEN ; l [c ++ ] = ' ' );
840+ for (c = addrlen ; c < LLEN ; l [c ++ ] = ' ' )
841+ ;
841842 }
842843 x = hextype == HEX_LITTLEENDIAN ? p ^ (octspergrp - 1 ) : p ;
843844 c = addrlen + 1 + (grplen * x ) / octspergrp ;
@@ -857,7 +858,12 @@ main(int argc, char *argv[])
857858 if (ebcdic )
858859 e = (e < 64 ) ? '.' : etoa64 [e - 64 ];
859860 /* When changing this update definition of LLEN above. */
860- c = addrlen + 3 + (grplen * cols - 1 )/octspergrp + p ;
861+ if (hextype == HEX_LITTLEENDIAN )
862+ /* last group will be fully used, round up */
863+ c = grplen * ((cols + octspergrp - 1 ) / octspergrp );
864+ else
865+ c = (grplen * cols - 1 ) / octspergrp ;
866+ c += addrlen + 3 + p ;
861867 l [c ++ ] =
862868#ifdef __MVS__
863869 (e >= 64 )
You can’t perform that action at this time.
0 commit comments