diff options
author | Martin Szulecki | 2013-09-27 00:12:27 +0200 |
---|---|---|
committer | Martin Szulecki | 2013-09-27 00:12:27 +0200 |
commit | bee4c222f8b8f2f0d127ba8e0f87a38e64218940 (patch) | |
tree | 13339de82eee51841a2f15c7a6b46e1e0aa7e733 /tools | |
parent | 9a28cfe084b9cf04c0170dce8821356638d50b38 (diff) | |
download | libirecovery-bee4c222f8b8f2f0d127ba8e0f87a38e64218940.tar.gz libirecovery-bee4c222f8b8f2f0d127ba8e0f87a38e64218940.tar.bz2 |
Fix whitespace errors and update code style
Diffstat (limited to 'tools')
-rw-r--r-- | tools/irecovery.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/tools/irecovery.c b/tools/irecovery.c index c4d6dce..effd3fb 100644 --- a/tools/irecovery.c +++ b/tools/irecovery.c @@ -169,6 +169,7 @@ int received_cb(irecv_client_t client, const irecv_event_t* event) { printf("%c", data[i]); } } + return 0; } @@ -179,6 +180,7 @@ int precommand_cb(irecv_client_t client, const irecv_event_t* event) { return -1; } } + return 0; } @@ -209,7 +211,9 @@ int postcommand_cb(irecv_client_t client, const irecv_event_t* event) { } } - if (command) free(command); + if (command) + free(command); + return 0; } @@ -217,11 +221,13 @@ int progress_cb(irecv_client_t client, const irecv_event_t* event) { if (event->type == IRECV_PROGRESS) { print_progress_bar(event->progress); } + return 0; } void print_progress_bar(double progress) { int i = 0; + if(progress < 0) { return; } @@ -231,6 +237,7 @@ void print_progress_bar(double progress) { } printf("\r["); + for(i = 0; i < 50; i++) { if(i < progress / 2) { printf("="); @@ -240,7 +247,9 @@ void print_progress_bar(double progress) { } printf("] %3.1f%%", progress); + fflush(stdout); + if(progress == 100) { printf("\n"); } @@ -268,7 +277,10 @@ int main(int argc, char* argv[]) { unsigned long long ecid = 0; char* argument = NULL; irecv_error_t error = 0; - if (argc == 1) print_usage(); + + if (argc == 1) + print_usage(); + while ((opt = getopt(argc, argv, "i:vhrsc:f:e:k::")) > 0) { switch (opt) { case 'i': @@ -327,7 +339,8 @@ int main(int argc, char* argv[]) { } } - if (verbose) irecv_set_debug_level(verbose); + if (verbose) + irecv_set_debug_level(verbose); irecv_init(); irecv_client_t client = NULL; @@ -395,5 +408,6 @@ int main(int argc, char* argv[]) { } irecv_close(client); + return 0; } |