summaryrefslogtreecommitdiffstats
path: root/usr.bin/hexdump
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1996-09-29 04:17:24 +0000
committerjoerg <joerg@FreeBSD.org>1996-09-29 04:17:24 +0000
commitf811c2ec39553f42bda2f64680e9265c11bbe9c0 (patch)
tree44e230e0786971b2d8e32d917a906bd00e1a6bfa /usr.bin/hexdump
parentee17503232540c096ddf2ea94afbeb499820c8c0 (diff)
downloadFreeBSD-src-f811c2ec39553f42bda2f64680e9265c11bbe9c0.zip
FreeBSD-src-f811c2ec39553f42bda2f64680e9265c11bbe9c0.tar.gz
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
Diffstat (limited to 'usr.bin/hexdump')
-rw-r--r--usr.bin/hexdump/Makefile2
-rw-r--r--usr.bin/hexdump/hexdump.115
-rw-r--r--usr.bin/hexdump/hexsyntax.c15
3 files changed, 28 insertions, 4 deletions
diff --git a/usr.bin/hexdump/Makefile b/usr.bin/hexdump/Makefile
index 1e0543b..24ad198 100644
--- a/usr.bin/hexdump/Makefile
+++ b/usr.bin/hexdump/Makefile
@@ -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>
diff --git a/usr.bin/hexdump/hexdump.1 b/usr.bin/hexdump/hexdump.1
index 563edac..a76d043 100644
--- a/usr.bin/hexdump/hexdump.1
+++ b/usr.bin/hexdump/hexdump.1
@@ -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
diff --git a/usr.bin/hexdump/hexsyntax.c b/usr.bin/hexdump/hexsyntax.c
index 829a6303f..e3bca0bc 100644
--- a/usr.bin/hexdump/hexsyntax.c
+++ b/usr.bin/hexdump/hexsyntax.c
@@ -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);
}
OpenPOWER on IntegriCloud