Now that we've already got "hexdump -C", make calling the command "hd"
having the same effect, and install a link for this. There is historic precedence for the command hd(1) (with roughly that output format) in Xenix, SCO, and a few SysV's that tooks the idea. Also, added a couple of spaces to the -C format to make the output better readable. Ok'ed by: phk
This commit is contained in:
parent
ac8ef33789
commit
38d54d33e4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=18550
@ -3,6 +3,8 @@
|
||||
PROG= hexdump
|
||||
SRCS= conv.c display.c hexdump.c hexsyntax.c odsyntax.c parse.c
|
||||
MAN1= hexdump.1 od.1
|
||||
MLINKS= hexdump.1 hd.1
|
||||
LINKS= ${BINDIR}/hexdump ${BINDIR}/od
|
||||
LINKS+= ${BINDIR}/hexdump ${BINDIR}/hd
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
@ -35,7 +35,7 @@
|
||||
.Dt HEXDUMP 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm hexdump
|
||||
.Nm hexdump, hd
|
||||
.Nd ascii, decimal, hexadecimal, octal dump
|
||||
.Sh SYNOPSIS
|
||||
.Nm hexdump
|
||||
@ -47,6 +47,15 @@
|
||||
.Op Fl s Ar skip
|
||||
.Ek
|
||||
.Ar file ...
|
||||
.Nm hd
|
||||
.Op Fl bcdovx
|
||||
.Op Fl e Ar format_string
|
||||
.Op Fl f Ar format_file
|
||||
.Op Fl n Ar length
|
||||
.Bk -words
|
||||
.Op Fl s Ar skip
|
||||
.Ek
|
||||
.Ar file ...
|
||||
.Sh DESCRIPTION
|
||||
The hexdump utility is a filter which displays the specified files, or
|
||||
the standard input, if no files are specified, in a user specified
|
||||
@ -69,6 +78,10 @@ data per line.
|
||||
Display the input offset in hexadecimal, followed by sixteen
|
||||
space-separated, two column, hexadecimal bytes, followed by the
|
||||
same sixteen bytes in %_p format enclosed in ``|'' characters.
|
||||
.Pp
|
||||
Calling the command
|
||||
.Nm hd
|
||||
implies this option.
|
||||
.It Fl d
|
||||
.Em Two-byte decimal display.
|
||||
Display the input offset in hexadecimal, followed by eight
|
||||
|
@ -56,6 +56,14 @@ newsyntax(argc, argvp)
|
||||
char *p, **argv;
|
||||
|
||||
argv = *argvp;
|
||||
if ((p = rindex(argv[0], 'h')) != NULL &&
|
||||
strcmp(p, "hd") == 0) {
|
||||
/* "Canonical" format, implies -C. */
|
||||
add("\"%08.8_Ax\n\"");
|
||||
add("\"%08.8_ax \" 8/1 \"%02x \" \" \"");
|
||||
add(" 8/1 \"%02x \" ");
|
||||
add("\" |\" 16/1 \"%_p\" \"|\\n\"");
|
||||
}
|
||||
while ((ch = getopt(argc, argv, "bcCde:f:n:os:vx")) != EOF)
|
||||
switch (ch) {
|
||||
case 'b':
|
||||
@ -68,8 +76,9 @@ newsyntax(argc, argvp)
|
||||
break;
|
||||
case 'C':
|
||||
add("\"%08.8_Ax\n\"");
|
||||
add("\"%08.8_ax \" 16/1 \"%02x \" ");
|
||||
add("\" |\" 16/1 \"%_p\" \"|\\n\"");
|
||||
add("\"%08.8_ax \" 8/1 \"%02x \" \" \"");
|
||||
add(" 8/1 \"%02x \" ");
|
||||
add("\" |\" 16/1 \"%_p\" \"|\\n\"");
|
||||
break;
|
||||
case 'd':
|
||||
add("\"%07.7_Ax\n\"");
|
||||
@ -127,6 +136,6 @@ void
|
||||
usage()
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"hexdump: [-bcdovx] [-e fmt] [-f fmt_file] [-n length] [-s skip] [file ...]\n");
|
||||
"hexdump: [-bcCdovx] [-e fmt] [-f fmt_file] [-n length] [-s skip] [file ...]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user