Handle parallel.extract.progress event — in-place counter. */
| 384 | |
| 385 | /* Handle parallel.extract.progress event — in-place counter. */ |
| 386 | static void on_extract_progress(const char *line) { |
| 387 | char done[CBM_SZ_32] = {0}; |
| 388 | char total[CBM_SZ_32] = {0}; |
| 389 | if (extract_kv(line, "done", done, (int)sizeof(done)) && |
| 390 | extract_kv(line, "total", total, (int)sizeof(total))) { |
| 391 | long d = strtol(done, NULL, CBM_DECIMAL_BASE); |
| 392 | long t = strtol(total, NULL, CBM_DECIMAL_BASE); |
| 393 | int pct = (t > 0) ? (int)((d * PERCENT) / t) : 0; |
| 394 | (void)fprintf(s_out, "\r Extracting: %ld/%ld files (%d%%)", d, t, pct); |
| 395 | (void)fflush(s_out); |
| 396 | atomic_store(&s_needs_newline, SKIP_ONE); |
| 397 | } |
| 398 | } |
| 399 | |
| 400 | /* Event dispatch table. */ |
| 401 | typedef struct { |
nothing calls this directly
no test coverage detected