[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Z and Y suffixes in xstrtol.c
From: |
Bernhard Voelker |
Subject: |
Re: Z and Y suffixes in xstrtol.c |
Date: |
Tue, 16 Dec 2014 09:15:05 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 |
On 12/16/2014 08:46 AM, Paul Eggert wrote:
> @@ -1384,27 +1385,33 @@ scanargs (int argc, char *const *argv)
> N_("invalid status level"));
> else
> {
> - bool invalid = false;
> + strtol_error invalid = LONGINT_OK;
> uintmax_t n = parse_integer (val, &invalid);
> + uintmax_t n_min = 0;
> + uintmax_t n_max = UINTMAX_MAX;
>
> if (operand_is (name, "ibs"))
> {
> - invalid |= ! (0 < n && n <= MAX_BLOCKSIZE (INPUT_BLOCK_SLOP));
> + n_min = 1;
> + n_max = MAX_BLOCKSIZE (INPUT_BLOCK_SLOP);
> input_blocksize = n;
> }
> else if (operand_is (name, "obs"))
> {
> - invalid |= ! (0 < n && n <= MAX_BLOCKSIZE (OUTPUT_BLOCK_SLOP));
> + n_min = 1;
> + n_max = MAX_BLOCKSIZE (INPUT_BLOCK_SLOP);
s/IN/OUT/
$ src/dd obs=1M count=1 if=/dev/zero of=x
1+0 records in
0+1 records out
512 bytes (512 B) copied, 0.000424504 s, 1.2 MB/s
$ ls -ldog x
-rw-r--r-- 1 512 Dec 16 09:11 x
Interestingly, the tests didn't catch this obs=... error.
Have a nice day,
Berny