diff --git a/clainsafecli/clainsafecli.c b/clainsafecli/clainsafecli.c index 20e0715..8fa5d03 100644 --- a/clainsafecli/clainsafecli.c +++ b/clainsafecli/clainsafecli.c @@ -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); + + +} diff --git a/clainsafecli/clainsafecli.h b/clainsafecli/clainsafecli.h index d92b70c..682c145 100644 --- a/clainsafecli/clainsafecli.h +++ b/clainsafecli/clainsafecli.h @@ -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); +