- float size_in_mb = 1.0f * total / (1024 * 1024);
- string_file styled_filename (current_uiout->can_emit_style_escape ());
- fprintf_styled (&styled_filename,
- file_name_style.style (),
- "%s",
- data->fname);
- std::string message
- = string_printf ("Downloading %.2f MB %s %s", size_in_mb, data->desc,
- styled_filename.c_str());
- data->meter.emplace (current_uiout, message, 1);
- }
+ /* Include the transfer size, if available. */
+ if (total > 0)
+ {
+ float size = 1.0f * total / 1024;
+ const char *unit = "KB";
+
+ /* If size is greater than 0.01 MB, set unit to MB. */
+ if (size > 10.24)
+ {
+ size /= 1024;
+ unit = "MB";
+ }
+
+ printf_filtered ("Downloading %.2f %s %s %ps...\n",
+ size, unit, data->desc,
+ styled_string (file_name_style.style (),
+ data->fname));
+ }
+ else
+ printf_filtered ("Downloading %s %ps...\n", data->desc,
+ styled_string (file_name_style.style (), data->fname));