aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-03-08 12:05:57 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-03-08 12:05:57 +0000
commitb86e543a13e5db71597e5d9adfbe01d01d3abf69 (patch)
treea2fe3d2317dd8eb56d59629b092285683e62e8de
parentc2d4fd876c77132caf593e397db615eb12266c7d (diff)
closes bug report #527032, --progress-bar works again and it adds a newline
after the transfer is done properly
-rw-r--r--src/main.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/main.c b/src/main.c
index 5d447d5b8..4d30a2c80 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1733,18 +1733,19 @@ int my_fwrite(void *buffer, size_t size, size_t nmemb, void *stream)
}
struct ProgressData {
- size_t total;
- size_t prev;
- size_t point;
+ int calls;
+ double total;
+ double prev;
+ double point;
int width;
FILE *out; /* where to write everything to */
};
int myprogress (void *clientp,
- size_t dltotal,
- size_t dlnow,
- size_t ultotal,
- size_t ulnow)
+ double dltotal,
+ double dlnow,
+ double ultotal,
+ double ulnow)
{
/* The original progress-bar source code was written for curl by Lars Aas,
and this new edition inherites some of his concepts. */
@@ -1763,6 +1764,8 @@ int myprogress (void *clientp,
bar->point = dlnow + ulnow; /* we've come this far */
+ bar->calls++; /* simply count invokes */
+
if(0 == total) {
int prevblock = bar->prev / 1024;
int thisblock = bar->point / 1024;
@@ -2403,6 +2406,12 @@ operate(struct Configurable *config, int argc, char *argv[])
res = curl_easy_perform(curl);
+ if(progressbar.calls) {
+ /* if the custom progress bar has been displayed, we output a
+ newline here */
+ fputs("\n", progressbar.out);
+ }
+
if(config->writeout) {
ourWriteOut(curl, config->writeout);
}