Added a more user friendly progress bar (in bytes so kinda to do) but

it shows the % at least.
This commit is contained in:
qorg11 2021-02-14 00:48:22 +01:00
parent 6608a22922
commit 3c03246af4
No account linked to committer's email address
2 changed files with 25 additions and 1 deletions

View File

@ -124,10 +124,12 @@ main(int argc, char **argv)
*/
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_perform(easy_handle);
if(!silent_flag) puts("");
puts(buffer);
curl_formfree(post);
@ -179,3 +181,17 @@ print_help()
"--help: print this message\n");
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);
}

View File

@ -12,3 +12,11 @@ store_link(const char *path, const char *buf);
void
print_help();
void
progress(void *clientp,
double dltotal,
double dlnow,
double ultotal,
double ulnow);