[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] [lmi-commits] master 802eb23 6/6: Refactor for simplicity
From: |
Vadim Zeitlin |
Subject: |
Re: [lmi] [lmi-commits] master 802eb23 6/6: Refactor for simplicity |
Date: |
Wed, 7 Dec 2016 01:39:41 +0100 |
On Wed, 7 Dec 2016 00:34:39 +0000 Greg Chicares <address@hidden> wrote:
GC> On 2016-12-06 23:48, Vadim Zeitlin wrote:
GC> [...reporting the first differing byte in two files that should be
identical...]
GC> >
GC> > GC> if(!files_are_identical(file0, file1))
GC> > GC> {
GC> > GC> std::ostringstream oss;
GC> > GC> oss << "cmp " << file0 << ' ' << file1;
GC> ^ --print-bytes
GC> > GC> system_command(oss.str());
GC> > GC> }
GC> > GC> That seems ideal.
GC> >
GC> > Sorry for being contrarian once again but it doesn't seem so to me. This
GC> > could result in a huge amount of output if there was an extra offset in
one
GC> > of the files, for example.
GC>
GC> This is too much...
GC>
GC> $cmp --verbose proprietary.dat proprietary2.dat |wc
GC> cmp: EOF on proprietary2.dat
GC> 5768829 17306487 92301264
GC>
GC> ...and this is too little...
GC>
GC> $cmp proprietary.dat proprietary2.dat
GC> proprietary.dat proprietary2.dat differ: byte 3, line 1
GC>
GC> ...but isn't this exactly what you want?
GC>
GC> $cmp --print-bytes proprietary.dat proprietary2.dat
GC> proprietary.dat proprietary2.dat differ: byte 3, line 1 is 55 - 37 ^_
Sorry, I have indeed forgot about how cmp worked and thought of it as if
it always ran in verbose mode -- but looking back at my shell history, it
was just due to always using with "-l" (a.k.a. "--verbose") option. So yes,
running "cmp -b" would work just fine, sorry for my unfounded contrariness!
VZ