bug-textutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch for byte order reporting in od.c


From: Paul Lai
Subject: Patch for byte order reporting in od.c
Date: Wed, 11 Apr 2001 11:01:42 -0700

Problem synopsis:
        od displays bytes in host-endian format, rather than as written
in the file.  Such that, evaluating the same file on Linux
(little-endian) and SunOS (sparc, big-endian), the results are
different.

        simple patch is supplied below....

Problem description:

A. Given test output generation problem, tod.c:
        main()
        {
          char buf[8];

          buf[0] = 0x1;
          buf[1] = 0x2;
          buf[2] = 0x3;
          buf[3] = 0x4;
          buf[4] = 0x5;
          buf[5] = 0x6;
          buf[6] = 0x7;
          buf[7] = 0x8;

          write(1,buf,sizeof(buf));
        }
  compiled:
        gcc -o tod tod.c
  executed:
        ./tod > out.tod

B. Original "od -x out.tod" produces the output on i386-Linux:
        0000000 0201 0403 0605 0807
        0000010

   And the output on sparc-SunOS:
        0000000 0102 0304 0506 0708
        0000010



PATCH is relative to textutils-2.0e

 <<od.c.patch>> 

Attachment: od.c.patch
Description: od.c.patch


reply via email to

[Prev in Thread] Current Thread [Next in Thread]