index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dave Reisner <d@falconindy.com> | 2011-03-17 09:01:30 -0400 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-03-23 03:43:58 -0500 |
commit | 82fb7a02021f94760fe53da8e09890b19005d129 (patch) | |
tree | 53f895587a1e16a00ed0f5046f3a9f34bb12da75 | |
parent | 768451c5e3a9e8458ed646f965a9f091de6a4512 (diff) |
-rw-r--r-- | lib/libalpm/dload.c | 20 |
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index 8be69e8a..3598e516 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -42,9 +42,12 @@ #include "util.h" #include "handle.h" -static int prevprogress; /* last download amount */ +#ifdef HAVE_LIBCURL +static double prevprogress; /* last download amount */ +#endif -static char *get_filename(const char *url) { +static char *get_filename(const char *url) +{ char *filename = strrchr(url, '/'); if(filename != NULL) { filename++; @@ -96,6 +99,14 @@ static int curl_progress(void *filename, double dltotal, double dlnow, return 0; } + /* initialize the progress bar here to avoid displaying it when + * a repo is up to date and nothing gets downloaded */ + if(DOUBLE_EQ(prevprogress, 0)) { + if(handle->dlcb) { + handle->dlcb((const char*)filename, 0, (long)dltotal); + } + } + if(dload_interrupted) { return 1; } @@ -214,9 +225,8 @@ static int curl_download_internal(const char *url, const char *localpath, sigaction(SIGINT, NULL, &sig_int[OLD]); sigaction(SIGINT, &sig_int[NEW], NULL); - /* set initial value of prevprogress to -1 which causes curl_progress() to - * initialize the progress bar with 0% once. */ - prevprogress = -1; + /* Progress 0 - initialize */ + prevprogress = 0; /* perform transfer */ handle->curlerr = curl_easy_perform(handle->curl); |