[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] [lmi-commits] master 802eb23 6/6: Refactor for simplicity
From: |
Greg Chicares |
Subject: |
Re: [lmi] [lmi-commits] master 802eb23 6/6: Refactor for simplicity |
Date: |
Wed, 7 Dec 2016 00:34:39 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0 |
On 2016-12-06 23:48, Vadim Zeitlin wrote:
[...reporting the first differing byte in two files that should be identical...]
>
> GC> if(!files_are_identical(file0, file1))
> GC> {
> GC> std::ostringstream oss;
> GC> oss << "cmp " << file0 << ' ' << file1;
^ --print-bytes
> GC> system_command(oss.str());
> GC> }
> GC> That seems ideal.
>
> Sorry for being contrarian once again but it doesn't seem so to me. This
> could result in a huge amount of output if there was an extra offset in one
> of the files, for example.
This is too much...
$cmp --verbose proprietary.dat proprietary2.dat |wc
cmp: EOF on proprietary2.dat
5768829 17306487 92301264
...and this is too little...
$cmp proprietary.dat proprietary2.dat
proprietary.dat proprietary2.dat differ: byte 3, line 1
...but isn't this exactly what you want?
$cmp --print-bytes proprietary.dat proprietary2.dat
proprietary.dat proprietary2.dat differ: byte 3, line 1 is 55 - 37 ^_