od

Larry Hall (RFK Partners, Inc) lhall@rfk.com
Tue Feb 19 09:03:00 GMT 2002


At 09:03 AM 2/19/2002, David wrote:
>Hi Mark,
>
>Thank you for your reply to my message about the od utility: I wrote:
>
>  >> I created at test file with 4 characters in it:
>  >> 
>  >>     HTTP
>  >> 
>  >> Then, I run od -bcx and I get:
>  >> 
>  >> 110 124 124 120 012 000
>  >>   H   T   T   P  \n  \0
>  >> 5448 5054 000a
>
>You wrote:
>
>  > That is correct in this little-endian platform, see
>  > http://info.astrian.net/jargon/terms/l/little-endian.html
>  > 
>  > >You can see that the hex values in the last line are reversed.
>  > >I think they should be 4854 5450 000a.
>  > 
>  > Only if you were on a big-endian platform.
>
>I can understand what you are saying if I interpret it to mean that
>the hex storage values on my machine WindowsNT - which I assume from
>you message is a big-endian platform - are faithfully represented
>by the output from the od -bcx display.


No, PC's are little-endian.


>What then surprises me is that the octal representation of this
>same storage is 110 124 124 120 which is what I would expect.
>
>It seems to me that you are suggesting that the only correct
>representation of the hex storage values would require od to
>ouput an ascii value of THPT. I reject, and od itself contradicts, 
>this interpretation of the storage values as being meaningful.


od formats the character representation to be in a "human readable"
format.  It's a convenience.  The hex still represents the data in the 
machine-stored order though.


>I urge you to reconsider your opinion and to modify od to 
>output 4854 5450.



I doubt you'll get your way.  od has always worked this way and a change
in behavior is likely to be considered a bug by others.  You'll probably
need to adjust your thinking when using od, find something else that fits
your way of thinking, or modify a local version to your liking.  Still, I'm
not the official word on od maintenance so perhaps you can convince the 
maintainers that you're right and everybody else is wrong! ;-)





Larry Hall                              lhall@rfk.com
RFK Partners, Inc.                      http://www.rfk.com
838 Washington Street                   (508) 893-9779 - RFK Office
Holliston, MA 01746                     (508) 893-9889 - FAX


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list