mirror of
git://git.sv.gnu.org/coreutils
synced 2026-05-06 07:06:38 -04:00
od: suppress address output on read error
We don't output an address for `od missing` or `od --strings .`, so be consistent and suppress the address for `od .`. * src/od.c (dump): Only output an address if no errors or the offset is non zero.
This commit is contained in:
@@ -1561,7 +1561,8 @@ dump (void)
|
||||
current_offset += n_bytes_read;
|
||||
}
|
||||
|
||||
format_address (current_offset, '\n');
|
||||
if (ok || current_offset)
|
||||
format_address (current_offset, '\n');
|
||||
|
||||
if (0 <= end_offset && end_offset <= current_offset)
|
||||
ok &= check_and_close (0);
|
||||
|
||||
@@ -54,4 +54,11 @@ printf '\001%10s\000%10s\000' | od -S10 > out || fail=1
|
||||
printf '%07o %10s\n' 1 '' 12 '' > exp || framework_failure_
|
||||
compare exp out || fail=1
|
||||
|
||||
# Ensure no address output for read error
|
||||
# (Users may use -N0 -j... to do base conversion)
|
||||
if ! cat . >/dev/null 2>&1; then
|
||||
returns_ 1 od -N1 . > out || fail=1
|
||||
compare /dev/null out || fail=1
|
||||
fi
|
||||
|
||||
Exit $fail
|
||||
|
||||
Reference in New Issue
Block a user