Mercurial > vim
comparison src/xxd/xxd.c @ 13326:7f1a5e8d8289 v8.0.1537
patch 8.0.1537: xxd does not skip NUL lines when using ebcdic
commit https://github.com/vim/vim/commit/085346f5a1ab5828b1fd80990d93172440c54724
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Feb 24 18:30:55 2018 +0100
patch 8.0.1537: xxd does not skip NUL lines when using ebcdic
Problem: Xxd does not skip NUL lines when using ebcdic.
Solution: Check for a NUL before converting a character for ebcdic. (Tim
Sell, closes #2668)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 24 Feb 2018 18:45:06 +0100 |
parents | b2aada04d84e |
children | 4f2acb6a10b6 |
comparison
equal
deleted
inserted
replaced
13325:a918cd8aa387 | 13326:7f1a5e8d8289 |
---|---|
825 | 825 |
826 c = (10 + (grplen * p) / octspergrp) - 1; | 826 c = (10 + (grplen * p) / octspergrp) - 1; |
827 for (i = 7; i >= 0; i--) | 827 for (i = 7; i >= 0; i--) |
828 l[++c] = (e & (1 << i)) ? '1' : '0'; | 828 l[++c] = (e & (1 << i)) ? '1' : '0'; |
829 } | 829 } |
830 if (e) | |
831 nonzero++; | |
830 if (ebcdic) | 832 if (ebcdic) |
831 e = (e < 64) ? '.' : etoa64[e-64]; | 833 e = (e < 64) ? '.' : etoa64[e-64]; |
832 /* When changing this update definition of LLEN above. */ | 834 /* When changing this update definition of LLEN above. */ |
833 l[12 + (grplen * cols - 1)/octspergrp + p] = | 835 l[12 + (grplen * cols - 1)/octspergrp + p] = |
834 #ifdef __MVS__ | 836 #ifdef __MVS__ |
835 (e >= 64) | 837 (e >= 64) |
836 #else | 838 #else |
837 (e > 31 && e < 127) | 839 (e > 31 && e < 127) |
838 #endif | 840 #endif |
839 ? e : '.'; | 841 ? e : '.'; |
840 if (e) | |
841 nonzero++; | |
842 n++; | 842 n++; |
843 if (++p == cols) | 843 if (++p == cols) |
844 { | 844 { |
845 l[c = (12 + (grplen * cols - 1)/octspergrp + p)] = '\n'; l[++c] = '\0'; | 845 l[c = (12 + (grplen * cols - 1)/octspergrp + p)] = '\n'; l[++c] = '\0'; |
846 xxdline(fpo, l, autoskip ? nonzero : 1); | 846 xxdline(fpo, l, autoskip ? nonzero : 1); |