From dd20797c1c75b13affdd2df955c897c06755edf0 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Sun, 26 Jun 2016 18:09:26 +0200 Subject: ipsw: Add ipsw_extract_to_file_with_progress() and remove progress bar from ipsw_extract_to_file() --- src/ipsw.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/ipsw.c') 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); -- cgit v1.1-32-gdbae