Commit 715e441
authored
cmp: helpful EOF messages (briandfoy#766)
* It's trivial to provide extra descriptive output when files differ at EOF, as done by GNU cmp
* Shell scripts running cmp would normally use the -s flag and check the exit code, i.e. the text description shouldn't be depended upon for portability
%dd if=/dev/urandom bs=512 count=1 of=rnd
%cp rnd rnd2
%echo >> rnd2
%touch empty
%perl cmp rnd rnd2 # test1: non-empty files, eof on arg1
cmp: EOF on rnd after byte 512, in line 6
%perl cmp rnd2 rnd # test2: non-empty files, eof on arg2
cmp: EOF on rnd after byte 512, in line 6
%perl cmp empty rnd # test3: arg1 empty
cmp: EOF on empty which is empty
%perl cmp rnd empty # test4: arg2 empty
cmp: EOF on empty which is empty1 parent 437e404 commit 715e441
1 file changed
+10
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
127 | | - | |
| 126 | + | |
| 127 | + | |
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
171 | | - | |
| 170 | + | |
| 171 | + | |
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| 202 | + | |
| 203 | + | |
202 | 204 | | |
203 | 205 | | |
204 | | - | |
| 206 | + | |
205 | 207 | | |
206 | 208 | | |
207 | | - | |
| 209 | + | |
208 | 210 | | |
209 | 211 | | |
210 | 212 | | |
| |||
0 commit comments