- title_buf = (char *)alloca (strlen (url) + 20);
- sprintf (title_buf, "Wget %s%s", url, nurl == 1 ? "" : " ...");
- SetConsoleTitle (title_buf);
+ num_urls = nurl;
+ if (title_buf)
+ xfree(title_buf);
+ if (curr_url)
+ xfree(curr_url);
+ title_buf = (char *)xmalloc (strlen (url) + 20);
+ curr_url = xstrdup(url);
+ sprintf(title_buf, "Wget %s%s", url, nurl == 1 ? "" : " ...");
+ SetConsoleTitle(title_buf);
+}
+
+void
+ws_percenttitle (double percent)
+{
+ if (num_urls == 1 && title_buf && curr_url && fabs(percent) <= 100.0)
+ {
+ sprintf (title_buf, "Wget [%.1f%%] %s", percent, curr_url);
+ SetConsoleTitle (title_buf);
+ }