cURL / Mailing Lists / curl-users / Single Mail

curl-users

[EXAMPLE] using wget progress functions

From: Juan F. Codagnone <juam_at_users.sourceforge.net>
Date: Thu, 12 Jun 2003 10:30:39 -0300

Hi,

I made this functions some months ago, and i think that someone can find them
usefull (note that only gpl programs can use it).It's an interface so you
can use wget's progress-bar using libcurl.

It seems to work fine on windows and linux. All you need is self contained in
progress.c) with the exception that you will need to delete the #include
<glib.h> and #include "i18n.h" and redefine xfree xmalloc and xrealloc (wget
used this functions) if you don't want to use glib.

you can see some screenshots at:
  http://embryos.homeip.net/~juam/code/iolsucker/screenshots.html

i use it writing something like:
        if( isatty(fileno(stdout)) )
                 fnc = bar_progress_callback;
        else
                 fnc = dot_progress_callback;
        curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, fnc);
        progress = new_progress_callback(fnc);
        curl_easy_setopt(curl, CURLOPT_URL, url);
        res = curl_easy_perform(curl);
        destroy_progress_callback(progress);

(it isn't beautiful but it works)

Best wishes,
        Juan.

--
Buenos Aires, Argentina                           12°C with winds at 14 km/h N


-------------------------------------------------------
This SF.NET email is sponsored by: eBay
Great deals on office technology -- on eBay now! Click here:
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5

  • application/pgp-signature attachment: signature
Received on 2003-06-12