from sources. (no patch.) add dd-like options Reference: /n/atom/patch/applied/pumpitup Date: Sat Mar 22 19:18:03 CET 2014 Signed-off-by: quanstro@quanstro.net --- /sys/src/cmd/pump.c Sat Mar 22 19:17:39 2014 +++ /sys/src/cmd/pump.c Sat Mar 22 19:17:40 2014 @@ -17,6 +17,7 @@ int ibsize; int obsize; int verb; +vlong off; void doinput(int); void dooutput(int); @@ -24,9 +25,9 @@ static void usage(void) { - fprint(2, "usage: pump [-f ofile] [-k KB-buffer] [-i ireadsize]\n" - "\t[-o owritesize] [-b iando] [-s start-KB] [-d sleeptime] " - "[files]\n"); + fprint(2, "usage: pump [-b iando] [-d sleeptime] [-f ofile] " + "[-i ireadsize]\n\t[-k KB-buffer] [-o owritesize] " + "[-s start-KB] [-S seek-offset]\n\t[-t mins] [files]\n"); exits("usage"); } @@ -40,6 +41,7 @@ obsize = ibsize = 8*1024; dsize = 0; fo = 1; + off = 0; ARGBEGIN { default: @@ -71,6 +73,11 @@ ssize = 800; ssize <<= 10; break; + case 'S': + off = atoll(EARGF(usage())); + if(off < 0) + sysfatal("seek offset %lld must be non-negative", off); + break; case 't': tsize = atoll(EARGF(usage())); tsize *= 10584000; /* minutes */ @@ -129,6 +136,7 @@ { long n, l, c; + seek(f, off, 0); lock(&arithlock); for (;;) { n = nin - nout; @@ -171,6 +179,7 @@ { long n, l, c, xnin; + seek(f, off, 0); lock(&arithlock); if(ssize > 0) { for (xnin = 0; xnin < ssize && !done; xnin += c) { --- /sys/man/1/pump Sat Mar 22 19:17:41 2014 +++ /sys/man/1/pump Sat Mar 22 19:17:41 2014 @@ -25,6 +25,12 @@ .B -s .I start-KB ] [ +.B -S +.I off +] [ +.B -t +.I minutes +] [ .I file \&... ] .SH DESCRIPTION @@ -93,6 +99,19 @@ prevents output until .I start-KB kilobytes have been read. +.TP +.B -S +seeks both input and output files to +.I off +before copying. +.TP +.B -t +stops output after +.I minutes +have passed. +This assumes that +.I pump +can copy 10,584,000 bytes per minute. .SH EXAMPLES Append a .IR venti (8) @@ -117,3 +136,10 @@ .I Pump processes spin while waiting for the circular buffer to fill or drain. +.PP +.IR Dd , +.IR ecp +and +.I pump +occupy slightly different niches +but perhaps some simplification is possible.