Subject: hexdump...
To: None <tech-net@netbsd.org>
From: Shashi Mara <pmara@cactus.org>
List: tech-net
Date: 03/24/1999 13:41:05
Hi,

This may not be the right mailng list but posted any way to get your
opinion.
( Network guys are masters of Endians (: )

The hexdump (default option) display "short" hex and the display depends
on endianess
of the machine. (Isn't this a bug ?)

I think it will be less confusing if  hexdump (default) display "bytes".

hexdump test_hex

// X86 machine
0000000 3231 3433 3635 3837 3139 3332 3534 3736
0000010 3938 3130 3332 3534 3736 3938 3130 0a32


// big Endian machine
0000000 3132 3334 3536 3738 3931 3233 3435 3637
0000010 3839 3031 3233 3435 3637 3839 3031 320a


I added -h option to display "byte" format. See the diff file ....

hexdump -h test_hex
0000000 31 32 33 34 35 36 37 38 39 31 32 33 34 35 36 37
0000010 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 0a




/****************************************************/
diff -w  /usr/src.bin/hexdump/hexsyntax.c hexsyntax.c_org

66c66
<  while ((ch = getopt(argc, argv, "bcde:f:n:os:vxh")) != -1)
---
>  while ((ch = getopt(argc, argv, "bcde:f:n:os:vx")) != -1)
111,114d110
<        break;
<     case 'h':
<        add("\"%07.7_Ax\n\"");
<        add("\"%07.7_ax \" 16/1 \"%02x \" \"\\n\"");
/****************************************************/



--
Regards
Shashi Peter Mara,  pmara@cactus.org