summaryrefslogtreecommitdiff
path: root/src/apk_print.h
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2013-06-19 08:47:09 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2013-06-19 10:00:31 +0000
commitadc5b0b16127049307283b9b59d7f0705ba8adc2 (patch)
tree55dd37153d8d5b8f1e9c88219f966e959cbfcdc0 /src/apk_print.h
parent0c1a26f25c73710896d8666b2de11e5215eda366 (diff)
downloadapk-tools-adc5b0b16127049307283b9b59d7f0705ba8adc2.tar.gz
apk-tools-adc5b0b16127049307283b9b59d7f0705ba8adc2.tar.bz2
apk-tools-adc5b0b16127049307283b9b59d7f0705ba8adc2.tar.xz
apk-tools-adc5b0b16127049307283b9b59d7f0705ba8adc2.zip
print: move progress bar update logic to apk_print_progress
- let the apk_print functions deal with the forced print itself. We avoid that the callbacks need to deal with the force flag. We can also get rid of the APK_PRINT_PROGRESS_* defines. - let the reader of --progress-fd decide how often things are updated rather than having a fixed granularity off 1/100 (percent) - avoid detect screen size and percent/bar calculations in case the --no-progress was given - track satistics for both the ascii bar and percent info and update bar only if either percent or bar changes. This makes the bar go smoother when width is wider than 100 chars and it makes the percent counter go smooth when screen width is less thann 100 chars. It also simplifies the callbacks as they no longer need to deal with update granularity.
Diffstat (limited to 'src/apk_print.h')
-rw-r--r--src/apk_print.h5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/apk_print.h b/src/apk_print.h
index 61e27d4..590b8f3 100644
--- a/src/apk_print.h
+++ b/src/apk_print.h
@@ -31,10 +31,7 @@ struct apk_indent {
int indent;
};
-#define APK_PRINT_PROGRESS_MASK 0xff
-#define APK_PRINT_PROGRESS_FORCE 0x100
-
-void apk_print_progress(int percent);
+void apk_print_progress(size_t done, size_t total);
int apk_print_indented(struct apk_indent *i, apk_blob_t blob);
void apk_print_indented_words(struct apk_indent *i, const char *text);
void apk_print_indented_fmt(struct apk_indent *i, const char *fmt, ...);