-#include "libopkg.h"
-opkg_download_progress_callback opkg_cb_download_progress = NULL;
-
-int
-curl_progress_func (char* url,
- double t, /* dltotal */
- double d, /* dlnow */
- double ultotal,
- double ulnow)
-{
- int i;
- int p = (t) ? d*100/t : 0;
-
- if (opkg_cb_download_progress)
- {
- static int prev = -1;
-
- /* don't report the same percentage multiple times
- * (this can occur due to rounding) */
- if (prev == p)
- return 0;
- prev = p;
-
- opkg_cb_download_progress (p, url);
- return 0;
- }
-
- /* skip progress bar if we haven't done started yet
- * this prevents drawing the progress bar if we receive an error such as
- * file not found */
- if (t == 0)
- return 0;
-
- printf ("\r%3d%% |", p);
- for (i = 1; i < 73; i++)
- {
- if (i <= p * 0.73)
- printf ("=");
- else
- printf ("-");
- }
- printf ("|");
- fflush(stdout);
- return 0;
-}
-
-int opkg_download(opkg_conf_t *conf, const char *src, const char *dest_file_name)
+int opkg_download(opkg_conf_t *conf, const char *src, const char *dest_file_name, curl_progress_func cb, void *data)