Fix last offset output using skip in od(1)
Yeah, if the skipping is longer than the file itself, we need to take the skip value, not the address. Also, only print the last newline when we've actually printed at least 1 address.
This commit is contained in:
parent
8be7c42863
commit
98e7e75ec6
4
od.c
4
od.c
|
@ -89,10 +89,10 @@ od(FILE *in, char *in_name, FILE *out, char *out_name)
|
||||||
if (feof(in) || ferror(in) || ferror(out))
|
if (feof(in) || ferror(in) || ferror(out))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (addr)
|
if (addr - skip > 0)
|
||||||
fputc('\n', out);
|
fputc('\n', out);
|
||||||
if (radix != 'n') {
|
if (radix != 'n') {
|
||||||
printaddress(out, addr);
|
printaddress(out, MAX(addr, skip));
|
||||||
fputc('\n', out);
|
fputc('\n', out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user