summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2008-12-14 23:18:54 (EST)
committer ticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2008-12-14 23:18:54 (EST)
commit924a46bf92e346c820f42f74a6792653894944e2 (patch)
treeadb4bacace1193b8742306f5e348df0122af6bf7
parentdd4f9919f1b184ce2c4df7f805b89462fcbf0158 (diff)
opkg: include the current url being downloaded in the progress callback
git-svn-id: http://opkg.googlecode.com/svn/trunk@13 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
-rw-r--r--libopkg.h2
-rw-r--r--opkg_download.c15
2 files changed, 9 insertions, 8 deletions
diff --git a/libopkg.h b/libopkg.h
index 429e3a1..274e37b 100644
--- a/libopkg.h
+++ b/libopkg.h
@@ -36,7 +36,7 @@ typedef int (*opkg_list_callback)(char *name, char *desc, char *version,
typedef int (*opkg_status_callback)(char *name, int istatus, char *desc,
void *userdata);
typedef char* (*opkg_response_callback)(char *question);
-typedef void (*opkg_download_progress_callback)(int percent);
+typedef void (*opkg_download_progress_callback)(int percent, char *url);
extern int opkg_op(int argc, char *argv[]); /* opkglib.c */
extern int opkg_init (opkg_message_callback mcall,
diff --git a/opkg_download.c b/opkg_download.c
index c0a66fe..3370b1f 100644
--- a/opkg_download.c
+++ b/opkg_download.c
@@ -34,11 +34,11 @@ opkg_download_progress_callback opkg_cb_download_progress = NULL;
#endif
int
-curl_progress_func (void* data,
- double t, /* dltotal */
- double d, /* dlnow */
- double ultotal,
- double ulnow)
+curl_progress_func (char* url,
+ double t, /* dltotal */
+ double d, /* dlnow */
+ double ultotal,
+ double ulnow)
{
int i;
int p = d*100/t;
@@ -46,7 +46,7 @@ curl_progress_func (void* data,
#ifdef OPKG_LIB
if (opkg_cb_download_progress)
{
- opkg_cb_download_progress (p);
+ opkg_cb_download_progress (p, url);
return 0;
}
#endif
@@ -142,7 +142,8 @@ int opkg_download(opkg_conf_t *conf, const char *src, const char *dest_file_name
{
curl_easy_setopt (curl, CURLOPT_URL, src);
curl_easy_setopt (curl, CURLOPT_WRITEDATA, file);
- curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);
+ curl_easy_setopt (curl, CURLOPT_NOPROGRESS, 0);
+ curl_easy_setopt (curl, CURLOPT_PROGRESSDATA, src);
curl_easy_setopt (curl, CURLOPT_PROGRESSFUNCTION, curl_progress_func);
if (conf->http_proxy || conf->ftp_proxy)
{