On 02/10/2012 04:57 PM, Pádraig Brady wrote:
> On 02/10/2012 04:21 PM, Jérémy Compostella wrote:
>> Pádraig, others,
>>
>> First, I added the missing seek_bytes feature.
>> Second, I re-wrote the patch in order to replace the _bytes operands by the
>> corresponding input/output flags.
>> Finally, I added some tests to check the new seek_bytes flag.
>>
>> I successfully run the entire tests suite.
> 
> Excellent.
> I'll review fully later.
> 
>> * doc/coreutils.texi (New features): Detail new flags and behaviors.
> 
> s/New features/dd invocation/
> 
> I've also attached a diff of some adjustments to --amend to the texinfo.

I've updated the diff slightly to add a couple more doc tweaks,
and ensure all lines are < 80 chars.
Note `make syntax-check` would have cought that for you.

I can't see any issue with the logic.
A very nice patch all round.

I'll apply this in the morning.

cheers,
Pádraig.
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 6efc5cc..02c3a2a 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -8060,15 +8060,21 @@ use @var{bytes} as the fixed record length.
 @item skip=@var{n}
 @opindex skip
 Skip @var{n} @samp{ibs}-byte blocks in the input file before copying.
+If @samp{iflag=skip_bytes} is specified, @var{n} is interpreted
+as a byte count rather than a block count.
 
 @item seek=@var{n}
 @opindex seek
 Skip @var{n} @samp{obs}-byte blocks in the output file before copying.
+if @samp{oflag=seek_bytes} is specified, @var{n} is interpreted
+as a byte count rather than a block count.
 
 @item count=@var{n}
 @opindex count
 Copy @var{n} @samp{ibs}-byte blocks from the input file, instead
 of everything until the end of the file.
+if @samp{iflag=count_bytes} is specified, @var{n} is interpreted
+as a byte count rather than a block count.
 
 @item status=noxfer
 @opindex status
@@ -8323,20 +8329,23 @@ This flag can be used only with @code{iflag}.
 
 @item count_bytes
 @opindex count_bytes
-Use byte unit instead of @samp{ibs}-byte block unit for the
-@samp{count=n} operand.
+Interpret the @samp{count=} operand as a byte count,
+rather than a block count, which allows specifying
+a length that is not a multiple of the I/O block size.
 This flag can be used only with @code{iflag}.
 
 @item skip_bytes
 @opindex skip_bytes
-Use byte unit instead of @samp{ibs}-byte block unit for the
-@samp{skip=n} operand.
+Interpret the @samp{skip=} operand as a byte count,
+rather than a block count, which allows specifying
+an offset that is not a multiple of the I/O block size.
 This flag can be used only with @code{iflag}.
 
 @item seek_bytes
 @opindex seek_bytes
-Use byte unit instead of @samp{obs}-byte block unit for the
-@samp{seek=n} operand.
+Interpret the @samp{seek=} operand as a byte count,
+rather than a block count, which allows specifying
+an offset that is not a multiple of the I/O block size.
 This flag can be used only with @code{oflag}.
 
 @end table
@@ -8361,13 +8370,12 @@ should not be too large---values larger than a few 
megabytes
 are generally wasteful or (as in the gigabyte..exabyte case) downright
 counterproductive or error-inducing.
 
-Use different @command{dd} invocations to use different block sizes
-for skipping and I/O@. To process data that is at an offset or size
-that is not a multiple of the I/O@ block size, you can use the
-count_bytes and skip_bytes input flag and the seek_bytes output flag.
-Alternatively the traditional method of separate @command{dd}
-invocations can be used.  For example, the following shell commands
-copy data in 512 KiB blocks between a disk and a tape, but do not save
+To process data that is at an offset or size that is not a
+multiple of the I/O@ block size, you can use the @samp{skip_bytes},
+@samp{seek_bytes} and @samp{count_bytes} flags.  Alternatively
+the traditional method of separate @command{dd} invocations can be used.
+For example, the following shell commands copy data
+in 512 KiB blocks between a disk and a tape, but do not save
 or restore a 4 KiB label at the start of the disk:
 
 @example
diff --git a/src/dd.c b/src/dd.c
index 7ab7cb2..e7f4037 100644
--- a/src/dd.c
+++ b/src/dd.c
@@ -598,14 +598,14 @@ Each FLAG symbol may be:\n\
       if (O_TEXT)
         fputs (_("  text      use text I/O for data\n"), stdout);
       if (O_COUNT_BYTES)
-        fputs (_("  count_bytes  use byte unit for the 'count=N' operand\
- (iflag only)\n"), stdout);
+        fputs (_("  count_bytes  treat 'count=N' as a byte count (iflag 
only)\n\
+"), stdout);
       if (O_SKIP_BYTES)
-        fputs (_("  skip_bytes  use byte unit for the 'skip=N' operand\
- (iflag only)\n"), stdout);
+        fputs (_("  skip_bytes  treat 'skip=N' as a byte count (iflag only)\n\
+"), stdout);
       if (O_SEEK_BYTES)
-        fputs (_("  seek_bytes  use byte unit for the 'seek=N' operand\
- (oflag only)\n"), stdout);
+        fputs (_("  seek_bytes  treat 'seek=N' as a byte count (oflag only)\n\
+"), stdout);
 
       {
         char const *siginfo_name = (SIGINFO == SIGUSR1 ? "USR1" : "INFO");
@@ -1863,9 +1863,11 @@ dd_copy (void)
 
   if (skip_records != 0 || skip_bytes != 0)
     {
-      uintmax_t us_bytes = input_offset + (skip_records * input_blocksize) + 
skip_bytes;
+      uintmax_t us_bytes = input_offset + (skip_records * input_blocksize)
+                           + skip_bytes;
       uintmax_t us_blocks = skip (STDIN_FILENO, input_file,
-                                  skip_records, input_blocksize, &skip_bytes, 
ibuf);
+                                  skip_records, input_blocksize, &skip_bytes,
+                                  ibuf);
       us_bytes -= input_offset;
 
       /* POSIX doesn't say what to do when dd detects it has been
@@ -1885,7 +1887,8 @@ dd_copy (void)
     {
       size_t bytes = seek_bytes;
       uintmax_t write_records = skip (STDOUT_FILENO, output_file,
-                                      seek_records, output_blocksize, &bytes, 
obuf);
+                                      seek_records, output_blocksize, &bytes,
+                                      obuf);
 
       if (write_records != 0 || bytes != 0)
         {

Reply via email to