RE: Byte-order in od -x (Win2K)

2005-06-28 Thread Igor Pechtchanski
On Tue, 28 Jun 2005, Dave Korn wrote:

Probably TITTTL material, but...

>   Now, I'd certainly agree that short int is a strange default for od (as
> indeed is octal, which it defaults to if you don't specify a base
> explicitly);

Why would octal be a strange default for a program called "octal dump"?
;-)

> but it's not 'strange' and nothing is 'transposed', it's simply
> correct-albeit-unexpected behaviour.

HTH,
Igor
-- 
http://cs.nyu.edu/~pechtcha/
  |\  _,,,---,,_[EMAIL PROTECTED]
ZZZzz /,`.-'`'-.  ;-;;,_[EMAIL PROTECTED]
 |,4-  ) )-,_. ,\ (  `'-'   Igor Pechtchanski, Ph.D.
'---''(_/--'  `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"The Sun will pass between the Earth and the Moon tonight for a total
Lunar eclipse..." -- WCBS Radio Newsbrief, Oct 27 2004, 12:01 pm EDT

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



RE: Byte-order in od -x (Win2K)

2005-06-28 Thread Dave Korn
Original Message
>From: Fergus Daly
>Sent: 28 June 2005 15:45

> 
> ("od -x .." outputs the strange transposition of bytes that you have
> referred to.)

  It's not a 'transposition of bytes'.  It's not bytes at all; "od -x"
defaults to reading 16-bit short integers, and outputs them in host-endian
order.  It's completely correct.  "od -x" is the same as "od -x2" which is
different from "od -x1" which is what the OP really wanted in the first
place.

  Now, I'd certainly agree that short int is a strange default for od (as
indeed is octal, which it defaults to if you don't specify a base
explicitly); but it's not 'strange' and nothing is 'transposed', it's simply
correct-albeit-unexpected behaviour.


cheers,
  DaveK
-- 
Can't think of a witty .sigline today


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: Byte-order in od -x (Win2K)

2005-06-28 Thread Fergus Daly
>> Exactly the other way round ...

~> echo abcd | od -tx1
000 61 62 63 64 0a
005

is nice; and, for some purposes

~> echo abcd | od -An -tx1
 61 62 63 64 0a

(or "od -An -tx1 ") is nicer still.

("od -x .." outputs the strange transposition of bytes that you have
referred to.)

Fergus

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: Byte-order in od -x (Win2K)

2005-06-28 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to Andreas Eibach on 6/28/2005 7:36 AM:
> Well, looks like a feature or a bug. :))

Feature.

> 
> $ ls -hog CD0.dat
> 
> -rw-r--r--  1  0 Jun 28  14:46 CD0.dat
> (minus r; w minus; r minus; minus r; minus minus)
> 
> 
> and now ...
> 
> $ ls -hog CD0.dat | od -x
> 
> 722d 2d77 2d72 722d  
> 
> Definitely wrong byte order.

Well, what do you expect on a little-endian machine, when you are passing
characters to od in big-endian order?

> Can that be tweaked somehow?

Yes - try "od --help" to see other display formats.  For example, "od -t
x1" prints hex bytes one at a time, with no endianness issues.  Or try "ls
- -hog | dd conv=swab status=noxfer | od -x", with that dd in the middle
doing a byte-swap.

- --
Life is short - so eat dessert first!

Eric Blake [EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.0 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCwVUz84KuGfSFAYARAj2CAKChJGQyLRGyaxIiwyGTIqcA/cthpgCg0/4S
w5fxo4Tn1ez3ipIVoRbATfE=
=jW4d
-END PGP SIGNATURE-

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Byte-order in od -x (Win2K)

2005-06-28 Thread Andreas Eibach

Well, looks like a feature or a bug. :))

$ ls -hog CD0.dat

-rw-r--r--  1  0 Jun 28  14:46 CD0.dat
(minus r; w minus; r minus; minus r; minus minus)


and now ...

$ ls -hog CD0.dat | od -x

722d 2d77 2d72 722d  

Definitely wrong byte order.
In human readable format:

(r minus; minus w; minus r; r minus; minus minus)

Exactly the other way round.
Can that be tweaked somehow?
Well, I cannot believe this is really intention ... 
(OS Win2000 + sp4)

-Andreas
_
Mit der Gruppen-SMS von WEB.DE FreeMail können Sie eine SMS an alle 
Freunde gleichzeitig schicken: http://freemail.web.de/features/?mc=021179




--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/