]> git.ipfire.org Git - thirdparty/coreutils.git/commit
truncate: ignore whitespace in --size parameters
authorPádraig Brady <P@draigBrady.com>
Sun, 29 Jun 2008 00:55:03 +0000 (01:55 +0100)
committerJim Meyering <meyering@redhat.com>
Mon, 30 Jun 2008 08:23:17 +0000 (10:23 +0200)
commit760bc6f7e73014e934a744a9d46ea8dbf5ba25c8
treed223895de4241de31247bc2034516340ebe0d089
parent9396eb903752ad4a1375235f62dcb094a5ae2cf0
truncate: ignore whitespace in --size parameters

Without this, `truncate -s '> -1' F` would truncate F to length 0,
and `truncate -s " +1" F` would truncate F to 1 byte.  Now, each
elicits a diagnostic.
* src/truncate.c: Skip leading white space in the --size option
argument and any white space after one of the relative modifiers,
so that the presence of a +/- modifier can be detected reliably.
* tests/misc/truncate-parameters: Add tests for the above.
src/truncate.c
tests/misc/truncate-parameters