fc886aa144
If this flag is not given, od(1) automatically replaces duplicate adjacent lines with an '*' for each reoccurence. If this flag is set, thus, no such filtering occurs. In this case this would mean having to somehow keep the last printed line in some backbuffer, building the next line and then doing the necessary comparisons. This basically means that we duplicate the functionality provided with uniq(1). So instead of $ od -t a > dump you'd rather do $ od -t a | uniq -f 1 -c > dump Skipping the first field is necessary, as the addresses obviously differ. Now, I was thinking hard why this flag even exists. If POSIX mandated to add the address before the asterisk, so we know the offset of duplicate occurrences, this would make sense. However, this is not the case. Using uniq(1) also gives nicer output: ~ $ echo "111111111111111111111111111111111111111111111111" | od -t a -v | uniq -f 1 -c 3 0000000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0000060 nl 1 0000061 in comparison to $ echo "111111111111111111111111111111111111111111111111" | od -t a 0000000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 * 0000060 nl 0000061 Before working on od(1), I didn't even know it would filter out duplicate adjacent lines like that. This is also a matter of predictability. Concluding, the v-flag is implicitly set and users urged to just use the existing tools provided by the system. I don't think we would break scripts either. Firstly, it's rather unlikely to have duplicate lines exactly matching the line-length of od(1). Secondly, even if a script did that specifically, in the worst case there would be a counting error or something. Given od(1) is mostly used interactively, we can safely assume this feature is for the benefit of the users. Ditch this legacy POSIX crap! Please enter the commit message for your changes. Lines starting
34 lines
741 B
Groff
34 lines
741 B
Groff
.Dd September 28, 2015
|
|
.Dt OD 1
|
|
.Os sbase
|
|
.Sh NAME
|
|
.Nm od
|
|
.Nd octal dump
|
|
.Sh SYNOPSIS
|
|
.Nm
|
|
.Op Fl A Ar d|o|x|n
|
|
.Op Fl t Ar a|c|d|o|u|x
|
|
.Op Fl v
|
|
.Op Ar file...
|
|
.Sh DESCRIPTION
|
|
.Nm
|
|
writes an octal dump of each
|
|
.Ar file
|
|
to stdout. If no
|
|
.Ar file
|
|
is given, then
|
|
.Nm
|
|
reads from stdin.
|
|
.Sh OPTIONS
|
|
.Bl -tag -width Ds
|
|
.It Fl A Ar d|o|x|n
|
|
Display the address in base \fId\fRecimal | \fIo\fRctal |
|
|
he\fIx\fRadecimal | \fIn\fRone. If unspecified, the default is octal.
|
|
.It Fl t Ar a|c|d|o|u|x
|
|
Display the content as n\fIa\fRmed character, \fIc\fRharacter, signed
|
|
\fId\fRecimal, \fIo\fRctal, \fIu\fRnsigned decimal, or
|
|
he\fIx\fRadecimal. If unspecified, the default is octal.
|
|
.It Fl v
|
|
Always set. Write all input data, including duplicate lines.
|
|
.El
|