od swap support?

2006-02-11 Thread Paul A. Clarke
Is there any interest in adding a flag to od to support byteswapping? 
It would've been somewhat useful to me recently, so I thought I'd throw 
the suggestion out...it also doesn't appear to be a significant effort, 
which I'll volunteer for, if there is a chance of acceptance.


Example:
> cat /proc/cpuinfo | grep ^cpu
cpu : POWER5 (gr)
> od -tx1 endianb
000 61 62 63 64
004
[EMAIL PROTECTED]:/tmp> od -tx2 endianb
000 6162 6364
004
[EMAIL PROTECTED]:/tmp> od -tx4 endianb
000 61626364
004

# cat /proc/cpuinfo | grep ^vendor_id
vendor_id   : GenuineIntel
# echo -n abcd > endiana
# od -c endiana
000   a   b   c   d
004
# od -tx1 endiana
000 61 62 63 64
004
# od -tx2 endiana
000 6261 6463
004
# od -tx4 endiana
000 64636261
004

Suggestion:
# cat /proc/cpuinfo | grep ^vendor_id
vendor_id   : GenuineIntel
# od -tx1 endiana
000 61 62 63 64
004
# od -tx2s endiana
000 6162 6364
004
# od -tx4s endiana
000 61626364
004

Regards,
Paul Clarke, IBM
(yes, my email changed since my last post here.  :-)


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: od swap support?

2006-02-11 Thread Paul Eggert
"Paul A. Clarke" <[EMAIL PROTECTED]> writes:

> Is there any interest in adding a flag to od to support byteswapping?

Would "dd conv=swab | od" suffice?


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: od swap support?

2006-02-13 Thread Paul A. Clarke

Paul Eggert wrote:

"Paul A. Clarke" <[EMAIL PROTECTED]> writes:

Is there any interest in adding a flag to od to support byteswapping?


Would "dd conv=swab | od" suffice?


No.  "dd conv=swab" only swaps byte pairs, thus 32bit or 64bit 
structured data will not appear "correctly" unswapped:


(GenuineIntel)# dd conv=swab if=endiana | od -tx4
0+1 records in
0+1 records out
000 63646162
004

(Power5)> od -tx4 endiana
000 61626364
004

However, you have a point in that perhaps this enhancement should 
instead be targeted at the "dd" command instead of "od".


Thoughts?
Regards,
Paul


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils