summaryrefslogtreecommitdiffstats
path: root/usr.bin/hexdump/hexsyntax.c
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/hexsyntax.c
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/hexsyntax.c')
-rw-r--r--usr.bin/hexdump/hexsyntax.c15
1 files changed, 12 insertions, 3 deletions
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