diff options
author | Felix Fietkau <nbd@openwrt.org> | 2016-01-17 13:37:59 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2016-01-17 13:37:59 +0100 |
commit | 8e6590cb48c611f480a5817d0cd5c7d7e6c5794d (patch) | |
tree | f958f5b1f4ea9e23b33124efdc3307137b57fc7a /progress.h | |
parent | 243aea1f7f1b50da2228a89812ff77a92dae82ad (diff) | |
download | uclient-8e6590cb48c611f480a5817d0cd5c7d7e6c5794d.tar.gz |
uclient-fetch: add progress bar support
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'progress.h')
-rw-r--r-- | progress.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/progress.h b/progress.h new file mode 100644 index 0000000..720060d --- /dev/null +++ b/progress.h @@ -0,0 +1,25 @@ +#ifndef __PROGRESS_H +#define __PROGRESS_H + +#include <sys/types.h> + +struct progress { + unsigned int last_size; + unsigned int last_update_sec; + unsigned int last_change_sec; + unsigned int start_sec; + char *curfile; +}; + + +void progress_init(struct progress *p, const char *curfile); +void progress_update(struct progress *p, off_t beg_size, + off_t transferred, off_t totalsize); + +static inline void +progress_free(struct progress *p) +{ + free(p->curfile); +} + +#endif |