summaryrefslogtreecommitdiffstats
path: root/src/io.c
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-01-07 21:45:11 +0200
committerTimo Teras <timo.teras@iki.fi>2009-01-07 21:45:11 +0200
commit052fbe3f86eaab1940f25824705d809cd9af59e5 (patch)
tree248d8da56e8660db2aa09a17bd52d25e0256cf29 /src/io.c
parentc7ffc96a16c6963fe0a07be7ee75e8f1f7426882 (diff)
various: make fancy progress bar and update todo
Diffstat (limited to 'src/io.c')
-rw-r--r--src/io.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/io.c b/src/io.c
index 2c94886..09b5212 100644
--- a/src/io.c
+++ b/src/io.c
@@ -108,7 +108,8 @@ size_t apk_istream_skip(struct apk_istream *is, size_t size)
return done;
}
-size_t apk_istream_splice(void *stream, int fd, size_t size)
+size_t apk_istream_splice(void *stream, int fd, size_t size,
+ apk_progress_cb cb, void *cb_ctx)
{
struct apk_istream *is = (struct apk_istream *) stream;
unsigned char *buf;
@@ -123,6 +124,9 @@ size_t apk_istream_splice(void *stream, int fd, size_t size)
return -1;
while (done < size) {
+ if (done != 0 && cb != NULL)
+ cb(cb_ctx, muldiv(APK_PROGRESS_SCALE, done, size));
+
togo = size - done;
if (togo > bufsz)
togo = bufsz;