Subject: bin/12147: od -tx1 (my fingers' favorite format) is not supported by od(1)
To: None <gnats-bugs@gnats.netbsd.org>
From: TheMan <atatat@atatdot.net>
List: netbsd-bugs
Date: 02/07/2001 08:29:33
>Number: 12147
>Category: bin
>Synopsis: od -tx1 (my fingers' favorite format) is not supported by od(1)
>Confidential: yes
>Severity: non-critical
>Priority: high
>Responsible: bin-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Wed Feb 07 08:32:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: TheMan
>Release: current from 20010130
>Organization:
none
>Environment:
System: NetBSD this 1.5R NetBSD 1.5R (THAT) #29: Mon Feb 5 01:17:39 EST 2001 root@this:/usr/src/sys/arch/i386/compile/THAT i386
Architecture: i386
Machine: i386
>Description:
my fingers learned to type od -tx1 many years ago and still type it
rather often when i'm dumping a file.
>How-To-Repeat:
% od -tx1
od: illegal option -- t
od: od(1) has been deprecated for hexdump(1).
hexdump: [-bcdovx] [-e fmt] [-f fmt_file] [-n length] [-s skip] [file ...]
>Fix:
here's a patch to odsyntax.c to make it mostly like the sunos version.
--- odsyntax.c-orig Sun Dec 20 07:17:39 1998
+++ odsyntax.c Fri Jan 12 08:12:31 2001
@@ -67,7 +67,7 @@
deprecated = 1;
argv = *argvp;
- while ((ch = getopt(argc, argv, "aBbcDdeFfHhIiLlOoPpswvXx")) != -1)
+ while ((ch = getopt(argc, argv, "aBbcDdeFfHhIiLlOoPpst:wvXx")) != -1)
switch (ch) {
case 'a':
odprecede();
@@ -127,6 +127,97 @@
case 'O':
odprecede();
add("4/4 \" %011o \" \"\\n\"");
+ break;
+ case 't':
+ for (ch = 0; optarg[ch]; ) {
+ odprecede();
+ switch (optarg[ch]) {
+ case 'a':
+ ch++;
+ add("16/1 \"%3_u \" \"\\n\"");
+ break;
+ case 'c':
+ ch++;
+ add("16/1 \"%3_c \" \"\\n\"");
+ break;
+ case 'f':
+ ch++;
+ if (optarg[ch] == 'F' ||
+ optarg[ch] == '4') {
+ ch++;
+ add("4/4 \" %14.7e\" \"\\n\"");
+ }
+ else if (optarg[ch] == 'L' ||
+ optarg[ch] == '8') {
+ ch++;
+ add("2/8 \" %16.14e\" \"\\n\"");
+ }
+ else if (optarg[ch] == 'D')
+ /* long doubles vary in size */
+ usage();
+ else
+ add("2/8 \" %16.14e\" \"\\n\"");
+ break;
+ case 'd': {
+ int x, y;
+ static char *fmt[4][4] = {
+ { "16/1 \"%3d \" \"\\n\"",
+ "8/2 \" %05d \" \"\\n\"",
+ "4/4 \" %010d \" \"\\n\"",
+ "2/8 \" %019d \" \"\\n\"" },
+ { "16/1 \"%03o \" \"\\n\"",
+ "8/2 \" %06o \" \"\\n\"",
+ "4/4 \" %011o\" \"\\n\"",
+ "2/8 \" %022o \" \"\\n\"" },
+ { "16/1 \"%03u \" \"\\n\"",
+ "8/2 \" %05u \" \"\\n\"",
+ "4/4 \" %010u \" \"\\n\"",
+ "2/8 \" %020u \" \"\\n\"" },
+ { "16/1 \" %02x \" \"\\n\"",
+ "8/2 \" %04x \" \"\\n\"",
+ "4/4 \" %08x \" \"\\n\"",
+ "2/8 \" %16x \" \"\\n\"" }
+ };
+ x = 0;
+ goto extensions;
+ case 'o':
+ x = 1;
+ goto extensions;
+ case 'u':
+ x = 2;
+ goto extensions;
+ case 'x':
+ x = 3;
+ extensions:
+ ch++;
+ y = 2;
+ if (optarg[ch] == 'C' ||
+ optarg[ch] == '1') {
+ ch++;
+ y = 0;
+ }
+ else if (optarg[ch] == 'S' ||
+ optarg[ch] == '2') {
+ ch++;
+ y = 1;
+ }
+ else if (optarg[ch] == 'I' ||
+ optarg[ch] == '4') {
+ ch++;
+ y = 2;
+ }
+ else if (optarg[ch] == 'L' ||
+ optarg[ch] == '8') {
+ ch++;
+ y = 3;
+ }
+ add(fmt[x][y]);
+ break;
+ }
+ default:
+ usage();
+ }
+ }
break;
case 'v':
vflag = ALL;
>Release-Note:
>Audit-Trail:
>Unformatted: