}
#endif
+static void
+print_length (wgint size, wgint start, int authoritative)
+{
+ logprintf (LOG_VERBOSE, _("Length: %s"), with_thousand_seps (size));
+ if (size >= 1024)
+ logprintf (LOG_VERBOSE, " (%s)", human_readable (size));
+ if (start > 0)
+ {
+ if (start >= 1024)
+ logprintf (LOG_VERBOSE, _(", %s (%s) remaining"),
+ with_thousand_seps (size - start),
+ human_readable (size - start));
+ else
+ logprintf (LOG_VERBOSE, _(", %s remaining"),
+ with_thousand_seps (size - start));
+ }
+ if (!authoritative)
+ logputs (LOG_VERBOSE, _(" (unauthoritative)\n"));
+}
+
/* Retrieves a file with denoted parameters through opening an FTP
connection to the server. It always closes the data connection,
and closes the control connection in case of error. */
if (con->proxy)
{
/* If proxy is in use, log in as username@target-site. */
- logname = xmalloc (strlen (user) + 1 + strlen (u->host) + 1);
- sprintf (logname, "%s@%s", user, u->host);
+ logname = concat_strings (user, "@", u->host, (char *) 0);
}
/* Login to the server: */
if (*len)
{
- logprintf (LOG_VERBOSE, _("Length: %s"), legible (*len));
- if (restval)
- logprintf (LOG_VERBOSE, _(" [%s to go]"), legible (*len - restval));
- logputs (LOG_VERBOSE, "\n");
+ print_length (*len, restval, 1);
expected_bytes = *len; /* for get_contents/show_progress */
}
else if (expected_bytes)
- {
- logprintf (LOG_VERBOSE, _("Length: %s"), legible (expected_bytes));
- if (restval)
- logprintf (LOG_VERBOSE, _(" [%s to go]"),
- legible (expected_bytes - restval));
- logputs (LOG_VERBOSE, _(" (unauthoritative)\n"));
- }
+ print_length (expected_bytes, restval, 0);
/* Get the contents of the document. */
flags = 0;