diff options
author | ticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2008-12-14 23:18:25 (EST) |
---|---|---|
committer | ticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2008-12-14 23:18:25 (EST) |
commit | b695d5b6e048f6b46e70b47f20072b91168159fc (patch) | |
tree | bd31b678312bbef36331e66a7c673d255f67f33e /opkg_download.c | |
parent | 38b334757dc77eb614abc55c40ff37cb99686154 (diff) |
opkg: add a download progress callback hook to libopkg
git-svn-id: http://opkg.googlecode.com/svn/trunk@10 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'opkg_download.c')
-rw-r--r-- | opkg_download.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/opkg_download.c b/opkg_download.c index a73406d..6859e92 100644 --- a/opkg_download.c +++ b/opkg_download.c @@ -28,6 +28,10 @@ #include "file_util.h" #include "str_util.h" +#ifdef OPKG_LIB +#include "libopkg.h" +opkg_download_progress_callback opkg_cb_download_progress = NULL; +#endif int curl_progress_func (void* data, @@ -38,6 +42,15 @@ curl_progress_func (void* data, { int i; int p = d*100/t; + +#ifdef LIBOPKG + if (opkg_cb_download_progress) + { + opkg_cb_download_progress (p); + return 0; + } +#endif + printf ("\r%3d%% |", p); for (i = 1; i < 73; i++) { |