summaryrefslogtreecommitdiffstats
path: root/src/ipsw.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2016-06-26 18:09:26 +0200
committerGravatar Nikias Bassen2016-06-26 18:09:26 +0200
commitdd20797c1c75b13affdd2df955c897c06755edf0 (patch)
treeccc6aee6f145b09ab0cc1cd2a9cb9e263524aca2 /src/ipsw.c
parente4cd7225dc002cbdba664a892ae7e5f4427e6a72 (diff)
downloadidevicerestore-dd20797c1c75b13affdd2df955c897c06755edf0.tar.gz
idevicerestore-dd20797c1c75b13affdd2df955c897c06755edf0.tar.bz2
ipsw: Add ipsw_extract_to_file_with_progress() and remove progress bar from ipsw_extract_to_file()
Diffstat (limited to 'src/ipsw.c')
-rw-r--r--src/ipsw.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/ipsw.c b/src/ipsw.c
index 061d00d..a0ed824 100644
--- a/src/ipsw.c
+++ b/src/ipsw.c
@@ -86,7 +86,8 @@ int ipsw_get_file_size(const char* ipsw, const char* infile, off_t* size) {
return 0;
}
-int ipsw_extract_to_file(const char* ipsw, const char* infile, const char* outfile) {
+int ipsw_extract_to_file_with_progress(const char* ipsw, const char* infile, const char* outfile, int print_progress)
+{
int ret = 0;
ipsw_archive* archive = ipsw_open(ipsw);
if (archive == NULL || archive->zip == NULL) {
@@ -145,8 +146,10 @@ int ipsw_extract_to_file(const char* ipsw, const char* infile, const char* outfi
}
bytes += size;
- progress = ((double)bytes / (double)zstat.size) * 100.0;
- print_progress_bar(progress);
+ if (print_progress) {
+ progress = ((double)bytes / (double)zstat.size) * 100.0;
+ print_progress_bar(progress);
+ }
}
fclose(fd);
@@ -156,6 +159,11 @@ int ipsw_extract_to_file(const char* ipsw, const char* infile, const char* outfi
return ret;
}
+int ipsw_extract_to_file(const char* ipsw, const char* infile, const char* outfile)
+{
+ return ipsw_extract_to_file_with_progress(ipsw, infile, outfile, 0);
+}
+
int ipsw_file_exists(const char* ipsw, const char* infile)
{
ipsw_archive* archive = ipsw_open(ipsw);