summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2006-12-22 10:09:37 +0100
committerJim Meyering <jim@meyering.net>2006-12-22 10:09:37 +0100
commitf24ff8f42b45f868876bde7d21046c01188d42a4 (patch)
treeb0a031d5b386b224b5bc6ad7c52d0b82acb05f29 /src
parent699188aa87648cc487ee7bcdaeebfcbbb182e356 (diff)
downloadcoreutils-f24ff8f42b45f868876bde7d21046c01188d42a4.tar.xz
* NEWS: dd bs= operands now silently override later ibs= and obs=,
as POSIX requires. * src/dd.c (scanargs): Implement it. * tests/dd/misc (outbytes): Test it. * doc/coreutils.texi (dd invocation): Specify that bs=N overrides later ibs and obs, undoing part of the previous change. (The behavior was wrong.)
Diffstat (limited to 'src')
-rw-r--r--src/dd.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/dd.c b/src/dd.c
index 3449e1253..1a3a4e426 100644
--- a/src/dd.c
+++ b/src/dd.c
@@ -873,6 +873,7 @@ static void
scanargs (int argc, char **argv)
{
int i;
+ size_t blocksize = 0;
for (i = optind; i < argc; i++)
{
@@ -923,7 +924,7 @@ scanargs (int argc, char **argv)
else if (STREQ (name, "bs"))
{
invalid |= ! (0 < n && n <= MAX_BLOCKSIZE (INPUT_BLOCK_SLOP));
- output_blocksize = input_blocksize = n;
+ blocksize = n;
}
else if (STREQ (name, "cbs"))
{
@@ -948,6 +949,9 @@ scanargs (int argc, char **argv)
}
}
+ if (blocksize)
+ input_blocksize = output_blocksize = blocksize;
+
/* If bs= was given, both `input_blocksize' and `output_blocksize' will
have been set to positive values. If either has not been set,
bs= was not given, so make sure two buffers are used. */