Handle parallel.extract.progress event — in-place counter. */
| 169 | |
| 170 | /* Handle parallel.extract.progress event — in-place counter. */ |
| 171 | static void on_extract_progress(const char *line) { |
| 172 | char done[CBM_SZ_32] = {0}; |
| 173 | char total[CBM_SZ_32] = {0}; |
| 174 | if (extract_kv(line, "done", done, (int)sizeof(done)) && |
| 175 | extract_kv(line, "total", total, (int)sizeof(total))) { |
| 176 | long d = strtol(done, NULL, CBM_DECIMAL_BASE); |
| 177 | long t = strtol(total, NULL, CBM_DECIMAL_BASE); |
| 178 | int pct = (t > 0) ? (int)((d * PERCENT) / t) : 0; |
| 179 | (void)fprintf(s_out, "\r Extracting: %ld/%ld files (%d%%)", d, t, pct); |
| 180 | (void)fflush(s_out); |
| 181 | atomic_store(&s_needs_newline, SKIP_ONE); |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | /* Event dispatch table. */ |
| 186 | typedef struct { |
nothing calls this directly
no test coverage detected