+#define TO_PERCENT(numerator, denominator) \
+ ((float)(((denominator) == 0) ? 0 : ((numerator) * 100 / (float)(denominator))))
+
+static int
+extract_progress(enum wimlib_progress_msg msg,
+ const union wimlib_progress_info *info)
+{
+ 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 0;
+}
+