[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: od: add explicit support for shell integers (intmax_t)
From: |
Pádraig Brady |
Subject: |
Re: od: add explicit support for shell integers (intmax_t) |
Date: |
Thu, 02 Oct 2014 01:24:39 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 |
On 10/01/2014 10:30 PM, John Isidore wrote:
> od supports 'long int' using L size e.g., '-t uL'. I suggest
> adding M size where M stands for sizeof(intmax_t): '-t uM'.
>
> Something like:
>
>
> diff --git i/src/od.c w/src/od.c
> index 18b1683..2dd1740 100644
> --- i/src/od.c
> +++ w/src/od.c
> @@ -671,6 +671,11 @@ decode_one_format (const char *s_orig, const char
> *s, const char **next,
> size = sizeof (long int);
> break;
>
> + case 'M':
> + ++s;
> + size = sizeof (intmax_t);
> + break;
> +
> default:
> if (! simple_strtoul (s, &p, &size))
> {
>
>
> As far as I can see, it should be enough (excluding tests, docs).
This seems like a good idea.
Note intmax_t maps to long long within od now.
Practically they're the same, but theoretically they may diverge.
So a full patch would best have handling of intmax_t separate.
Also it would be worth supporting a size of 'LL' corresponding
to long long (falling back to long where unavailable).
I see z/os for example, supports an 'LL' specification.
thanks,
Pádraig.