mirror of git://git.suckless.org/ubase
dd: allow count=0
This commit is contained in:
parent
e5d88b0f30
commit
c64b5b04c7
3
dd.c
3
dd.c
|
@ -126,7 +126,7 @@ prepare_copy(struct dd_config *ddc, int *ifd, int *ofd)
|
||||||
ddc->count *= ddc->bs;
|
ddc->count *= ddc->bs;
|
||||||
|
|
||||||
/* If no count is given, its the filesize minus skip offset */
|
/* If no count is given, its the filesize minus skip offset */
|
||||||
if (ddc->count == 0)
|
if (ddc->count == (uint64_t) -1)
|
||||||
ddc->count = ddc->fsize - ddc->skip;
|
ddc->count = ddc->fsize - ddc->skip;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -243,6 +243,7 @@ main(int argc, char *argv[])
|
||||||
config.bs = 1<<16;
|
config.bs = 1<<16;
|
||||||
config.in = NULL;
|
config.in = NULL;
|
||||||
config.out = NULL;
|
config.out = NULL;
|
||||||
|
config.count = (uint64_t) -1;
|
||||||
|
|
||||||
/* emulate 'dd' argument parsing */
|
/* emulate 'dd' argument parsing */
|
||||||
for (i = 1; i < argc; ++i) {
|
for (i = 1; i < argc; ++i) {
|
||||||
|
|
Loading…
Reference in New Issue