+#define TO_PERCENT(numerator, denominator) \
+ ((float)(((denominator) == 0) ? 0 : ((numerator) * 100 / (float)(denominator))))
+
+static enum wimlib_progress_status
+extract_progress(enum wimlib_progress_msg msg,
+ union wimlib_progress_info *info, void *progctx)
+{
+ switch (msg) {
+ case WIMLIB_PROGRESS_MSG_EXTRACT_STREAMS:
+ printf("Extracting files: %.2f%% complete\n",
+ TO_PERCENT(info->extract.completed_bytes,
+ info->extract.total_bytes));
+ break;
+ default:
+ break;
+ }
+ return WIMLIB_PROGRESS_STATUS_CONTINUE;
+}
+