Handle parallel.extract.progress event — in-place counter. */
| 307 | |
| 308 | /* Handle parallel.extract.progress event — in-place counter. */ |
| 309 | static void on_extract_progress(const char *line) { |
| 310 | char done[CBM_SZ_32] = {0}; |
| 311 | char total[CBM_SZ_32] = {0}; |
| 312 | if (extract_kv(line, "done", done, (int)sizeof(done)) && |
| 313 | extract_kv(line, "total", total, (int)sizeof(total))) { |
| 314 | long d = strtol(done, NULL, CBM_DECIMAL_BASE); |
| 315 | long t = strtol(total, NULL, CBM_DECIMAL_BASE); |
| 316 | int pct = (t > 0) ? (int)((d * PERCENT) / t) : 0; |
| 317 | (void)fprintf(s_out, "\r Extracting: %ld/%ld files (%d%%)", d, t, pct); |
| 318 | (void)fflush(s_out); |
| 319 | atomic_store(&s_needs_newline, SKIP_ONE); |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | /* Event dispatch table. */ |
| 324 | typedef struct { |
nothing calls this directly
no test coverage detected