mirror of
https://github.com/roswell/roswell.git
synced 2026-09-10 07:16:17 -04:00
show progress of downloading
This commit is contained in:
parent
d1ee0b18fa
commit
45069a1753
|
|
@ -101,7 +101,7 @@ int download(struct install_options* param)
|
|||
return 0;
|
||||
/* fail */
|
||||
}else{
|
||||
printf("download done:%s\n",url);
|
||||
printf("\ndone\n");
|
||||
}
|
||||
}
|
||||
s(impl_archive),s(url);
|
||||
|
|
|
|||
|
|
@ -2,9 +2,23 @@
|
|||
#include <stdlib.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
static int count=0;
|
||||
static int block=10240;
|
||||
static int fold=90;
|
||||
|
||||
static size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream)
|
||||
{
|
||||
int written = fwrite(ptr, size, nmemb, (FILE *)stream);
|
||||
int current = count/block;
|
||||
int dots;
|
||||
int i;
|
||||
count+=written;
|
||||
for(i=current;i<count/block;++i){
|
||||
printf(".");
|
||||
fflush(stdout);
|
||||
if(i%fold==0)
|
||||
printf("\n");
|
||||
}
|
||||
return written;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue