Commit 140eca1
dd: add count_bytes, skip_bytes and seek_bytes flags
dd now accepts the count_bytes and skip_bytes input flag and the
seek_bytes output flag, to more easily allow processing portions of a
file.
* src/dd.c (scanargs): Compute skip_records and skip_bytes when
'skip_bytes' iflag is used. Compute max_records and max_bytes when
'count_bytes' iflag is used. Compute seek_records and seek_bytes
when 'seek_bytes' oflag is used.
(skip_via_lseek): Use new 'bytes' parameter and handle potential
'records' equals to zero. Update the bytes parameter when called with
'fdesc' equal to STDOUT_FILENO. Update the header comments.
(dd_copy): Skip accordingly to skip_records AND skip_bytes. Count
accordingly to max_records AND max_bytes. Seek on output accordingly
to seek_records AND seek_bytes.
* NEWS (New features): Mention it.
* doc/coreutils.texi (dd invocation): Detail new flags and behaviors.
* tests/dd/bytes: New file. Tests for these new flags.
* tests/Makefile.am (TESTS): Add it.1 parent da2b32e commit 140eca1
5 files changed
+253
-64
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
5 | 10 | | |
6 | 11 | | |
7 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8057 | 8057 | | |
8058 | 8058 | | |
8059 | 8059 | | |
8060 | | - | |
| 8060 | + | |
8061 | 8061 | | |
8062 | | - | |
| 8062 | + | |
| 8063 | + | |
| 8064 | + | |
8063 | 8065 | | |
8064 | | - | |
| 8066 | + | |
8065 | 8067 | | |
8066 | | - | |
| 8068 | + | |
| 8069 | + | |
| 8070 | + | |
8067 | 8071 | | |
8068 | | - | |
| 8072 | + | |
8069 | 8073 | | |
8070 | | - | |
| 8074 | + | |
8071 | 8075 | | |
| 8076 | + | |
| 8077 | + | |
8072 | 8078 | | |
8073 | 8079 | | |
8074 | 8080 | | |
| |||
8321 | 8327 | | |
8322 | 8328 | | |
8323 | 8329 | | |
| 8330 | + | |
| 8331 | + | |
| 8332 | + | |
| 8333 | + | |
| 8334 | + | |
| 8335 | + | |
| 8336 | + | |
| 8337 | + | |
| 8338 | + | |
| 8339 | + | |
| 8340 | + | |
| 8341 | + | |
| 8342 | + | |
| 8343 | + | |
| 8344 | + | |
| 8345 | + | |
| 8346 | + | |
| 8347 | + | |
| 8348 | + | |
| 8349 | + | |
| 8350 | + | |
8324 | 8351 | | |
8325 | 8352 | | |
8326 | 8353 | | |
| |||
8343 | 8370 | | |
8344 | 8371 | | |
8345 | 8372 | | |
8346 | | - | |
8347 | | - | |
8348 | | - | |
8349 | | - | |
| 8373 | + | |
| 8374 | + | |
| 8375 | + | |
| 8376 | + | |
| 8377 | + | |
| 8378 | + | |
| 8379 | + | |
8350 | 8380 | | |
8351 | 8381 | | |
8352 | 8382 | | |
| |||
0 commit comments