public
/
FUZIX.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1b114e9
)
Fix count= option to dd
author
Will Sowerbutts
<will@sowerbutts.com>
Sun, 25 Jan 2015 22:53:20 +0000
(22:53 +0000)
committer
Will Sowerbutts
<will@sowerbutts.com>
Mon, 26 Jan 2015 21:37:08 +0000
(21:37 +0000)
Applications/util/dd.c
patch
|
blob
|
history
diff --git
a/Applications/util/dd.c
b/Applications/util/dd.c
index
e29bd39
..
be694f1
100644
(file)
--- a/
Applications/util/dd.c
+++ b/
Applications/util/dd.c
@@
-71,6
+71,7
@@
void main(int argc, char *argv[])
long skipval;
long intotal;
long outtotal;
+ long inmax;
char *buf;
infile = NULL;
@@
-79,6
+80,7
@@
void main(int argc, char *argv[])
skipval = 0;
blocksize = 512;
count = 0x7fffffff;
+ inmax = 0;
while (--argc > 0) {
str = *++argv;
@@
-204,6
+206,8
@@
void main(int argc, char *argv[])
goto cleanup;
}
}
+ if(count != 0x7fffffff)
+ inmax = count * blocksize;
while ((incc = read(infd, buf, blocksize)) > 0) {
intotal += incc;
cp = buf;
@@
-222,6
+226,8
@@
void main(int argc, char *argv[])
cp += outcc;
incc -= outcc;
}
+ if(inmax && intotal >= inmax)
+ break;
}
if (incc < 0)