GNU bug report logs - #16578
Wish: Support for non-native endianness in od

Previous Next

Package: coreutils;

Reported by: nisse <at> lysator.liu.se (Niels Möller)

Date: Tue, 28 Jan 2014 13:27:01 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Jim Meyering <jim <at> meyering.net>
To: 16578 <at> debbugs.gnu.org, Pádraig Brady <P <at> draigbrady.com>, nisse <at> lysator.liu.se
Cc: 16578-done <at> debbugs.gnu.org
Subject: bug#16578: Wish: Support for non-native endianness in od
Date: Sat, 8 Feb 2014 17:23:21 -0800
On Sat, Feb 8, 2014 at 2:01 PM, Pádraig Brady <P <at> draigbrady.com> wrote:
>>> +      if (input_swap && sizeof(T) > 1)                                  \
>>> +        {                                                               \
>>> +          int j;                                                        \

The new patch looks complete.  Thanks to both of you.
One nit: please change the type of "j" here (identical in attached)
to be unsigned, to match that of the upper bound.

>>> +          union {                                                       \
>>> +            T x;                                                        \
>>> +            char b[sizeof(T)];                                          \
>>> +          } u;                                                          \
>>> +          for (j = 0; j < sizeof(T); j++)                               \
>>> +            u.b[j] = ((const char *) p)[sizeof(T) - 1 - j];             \

Re this function in the new test,

> +in_swapped() { printf '%s' "$in" | sed "s/.\{$1\}/&\\n/g" | rev | tr -d '\n'; }

That would be our first use of "rev". Is it ubiquitous enough to depend on?




This bug report was last modified 11 years and 100 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.