diff options
| author | 2013-09-27 00:12:27 +0200 | |
|---|---|---|
| committer | 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) { | |||
| 169 | printf("%c", data[i]); | 169 | printf("%c", data[i]); |
| 170 | } | 170 | } |
| 171 | } | 171 | } |
| 172 | |||
| 172 | return 0; | 173 | return 0; |
| 173 | } | 174 | } |
| 174 | 175 | ||
| @@ -179,6 +180,7 @@ int precommand_cb(irecv_client_t client, const irecv_event_t* event) { | |||
| 179 | return -1; | 180 | return -1; |
| 180 | } | 181 | } |
| 181 | } | 182 | } |
| 183 | |||
| 182 | return 0; | 184 | return 0; |
| 183 | } | 185 | } |
| 184 | 186 | ||
| @@ -209,7 +211,9 @@ int postcommand_cb(irecv_client_t client, const irecv_event_t* event) { | |||
| 209 | } | 211 | } |
| 210 | } | 212 | } |
| 211 | 213 | ||
| 212 | if (command) free(command); | 214 | if (command) |
| 215 | free(command); | ||
| 216 | |||
| 213 | return 0; | 217 | return 0; |
| 214 | } | 218 | } |
| 215 | 219 | ||
| @@ -217,11 +221,13 @@ int progress_cb(irecv_client_t client, const irecv_event_t* event) { | |||
| 217 | if (event->type == IRECV_PROGRESS) { | 221 | if (event->type == IRECV_PROGRESS) { |
| 218 | print_progress_bar(event->progress); | 222 | print_progress_bar(event->progress); |
| 219 | } | 223 | } |
| 224 | |||
| 220 | return 0; | 225 | return 0; |
| 221 | } | 226 | } |
| 222 | 227 | ||
| 223 | void print_progress_bar(double progress) { | 228 | void print_progress_bar(double progress) { |
| 224 | int i = 0; | 229 | int i = 0; |
| 230 | |||
| 225 | if(progress < 0) { | 231 | if(progress < 0) { |
| 226 | return; | 232 | return; |
| 227 | } | 233 | } |
| @@ -231,6 +237,7 @@ void print_progress_bar(double progress) { | |||
| 231 | } | 237 | } |
| 232 | 238 | ||
| 233 | printf("\r["); | 239 | printf("\r["); |
| 240 | |||
| 234 | for(i = 0; i < 50; i++) { | 241 | for(i = 0; i < 50; i++) { |
| 235 | if(i < progress / 2) { | 242 | if(i < progress / 2) { |
| 236 | printf("="); | 243 | printf("="); |
| @@ -240,7 +247,9 @@ void print_progress_bar(double progress) { | |||
| 240 | } | 247 | } |
| 241 | 248 | ||
| 242 | printf("] %3.1f%%", progress); | 249 | printf("] %3.1f%%", progress); |
| 250 | |||
| 243 | fflush(stdout); | 251 | fflush(stdout); |
| 252 | |||
| 244 | if(progress == 100) { | 253 | if(progress == 100) { |
| 245 | printf("\n"); | 254 | printf("\n"); |
| 246 | } | 255 | } |
| @@ -268,7 +277,10 @@ int main(int argc, char* argv[]) { | |||
| 268 | unsigned long long ecid = 0; | 277 | unsigned long long ecid = 0; |
| 269 | char* argument = NULL; | 278 | char* argument = NULL; |
| 270 | irecv_error_t error = 0; | 279 | irecv_error_t error = 0; |
| 271 | if (argc == 1) print_usage(); | 280 | |
| 281 | if (argc == 1) | ||
| 282 | print_usage(); | ||
| 283 | |||
| 272 | while ((opt = getopt(argc, argv, "i:vhrsc:f:e:k::")) > 0) { | 284 | while ((opt = getopt(argc, argv, "i:vhrsc:f:e:k::")) > 0) { |
| 273 | switch (opt) { | 285 | switch (opt) { |
| 274 | case 'i': | 286 | case 'i': |
| @@ -327,7 +339,8 @@ int main(int argc, char* argv[]) { | |||
| 327 | } | 339 | } |
| 328 | } | 340 | } |
| 329 | 341 | ||
| 330 | if (verbose) irecv_set_debug_level(verbose); | 342 | if (verbose) |
| 343 | irecv_set_debug_level(verbose); | ||
| 331 | 344 | ||
| 332 | irecv_init(); | 345 | irecv_init(); |
| 333 | irecv_client_t client = NULL; | 346 | irecv_client_t client = NULL; |
| @@ -395,5 +408,6 @@ int main(int argc, char* argv[]) { | |||
| 395 | } | 408 | } |
| 396 | 409 | ||
| 397 | irecv_close(client); | 410 | irecv_close(client); |
| 411 | |||
| 398 | return 0; | 412 | return 0; |
| 399 | } | 413 | } |
