Added a more user friendly progress bar (in bytes so kinda to do) but
it shows the % at least.
This commit is contained in:
parent
6608a22922
commit
3c03246af4
2 changed files with 25 additions and 1 deletions
|
@ -124,10 +124,12 @@ main(int argc, char **argv)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
curl_easy_setopt(easy_handle,CURLOPT_NOPROGRESS,silent_flag);
|
curl_easy_setopt(easy_handle,CURLOPT_NOPROGRESS,silent_flag);
|
||||||
|
curl_easy_setopt(easy_handle,CURLOPT_PROGRESSFUNCTION,progress);
|
||||||
|
|
||||||
curl_easy_setopt(easy_handle,CURLOPT_HTTPPOST,post);
|
curl_easy_setopt(easy_handle,CURLOPT_HTTPPOST,post);
|
||||||
|
|
||||||
curl_easy_perform(easy_handle);
|
curl_easy_perform(easy_handle);
|
||||||
|
if(!silent_flag) puts("");
|
||||||
puts(buffer);
|
puts(buffer);
|
||||||
|
|
||||||
curl_formfree(post);
|
curl_formfree(post);
|
||||||
|
@ -179,3 +181,17 @@ print_help()
|
||||||
"--help: print this message\n");
|
"--help: print this message\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
progress(void *clientp,
|
||||||
|
double dltotal,
|
||||||
|
double dlnow,
|
||||||
|
double ultotal,
|
||||||
|
double ulnow)
|
||||||
|
{
|
||||||
|
printf("\r%0.f uploaded of %0.f (%0.f%%)",ulnow,ultotal,
|
||||||
|
ulnow*100/ultotal);
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -12,3 +12,11 @@ store_link(const char *path, const char *buf);
|
||||||
|
|
||||||
void
|
void
|
||||||
print_help();
|
print_help();
|
||||||
|
|
||||||
|
void
|
||||||
|
progress(void *clientp,
|
||||||
|
double dltotal,
|
||||||
|
double dlnow,
|
||||||
|
double ultotal,
|
||||||
|
double ulnow);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue