Skip to content

Commit

Permalink
Always show percentage in title on Windows
Browse files Browse the repository at this point in the history
to be practical
  • Loading branch information
lifenjoiner committed Jul 29, 2024
1 parent 3eac868 commit f3163c2
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 31 deletions.
30 changes: 19 additions & 11 deletions src/ftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2036,20 +2036,28 @@ ftp_loop_internal (struct url *u, struct url *original_url, struct fileinfo *f,
/* Get the current time string. */
tms = datetime_str (time (NULL));
/* Print fetch message, if opt.verbose. */
if (opt.verbose)
{
char *hurl = url_string (u, URL_AUTH_HIDE_PASSWD);
char tmp[256];
strcpy (tmp, " ");
if (count > 1)
sprintf (tmp, _("(try:%2d)"), count);
logprintf (LOG_VERBOSE, "--%s-- %s\n %s => %s\n",
tms, hurl, tmp, quote (locf));
#ifdef WINDOWS
ws_changetitle (hurl);
{
char *hurl = url_string (u, URL_AUTH_HIDE_PASSWD);
#endif
if (opt.verbose)
{
char *hurl = url_string (u, URL_AUTH_HIDE_PASSWD);
char tmp[256];
strcpy (tmp, " ");
if (count > 1)
sprintf (tmp, _("(try:%2d)"), count);
logprintf (LOG_VERBOSE, "--%s-- %s\n %s => %s\n",
tms, hurl, tmp, quote (locf));
#ifndef WINDOWS
xfree (hurl);
#endif
}
#ifdef WINDOWS
ws_changetitle (hurl);
xfree (hurl);
}
}
#endif
/* Send getftp the proper length, if fileinfo was provided. */
if (f && f->type != FT_SYMLINK)
len = f->size;
Expand Down
46 changes: 27 additions & 19 deletions src/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -4388,28 +4388,36 @@ http_loop (struct url *u, struct url *original_url, char **newloc,
_("Spider mode enabled. Check if remote file exists.\n"));

/* Print fetch message, if opt.verbose. */
if (opt.verbose)
{
char *hurl = url_string (u, URL_AUTH_HIDE_PASSWD);

if (count > 1)
{
char tmp[256];
sprintf (tmp, _("(try:%2d)"), count);
logprintf (LOG_NOTQUIET, "--%s-- %s %s\n",
tms, tmp, hurl);
}
else
{
logprintf (LOG_NOTQUIET, "--%s-- %s\n",
tms, hurl);
}

#ifdef WINDOWS
ws_changetitle (hurl);
{
char *hurl = url_string (u, URL_AUTH_HIDE_PASSWD);
#endif
if (opt.verbose)
{
#ifndef WINDOWS
char *hurl = url_string (u, URL_AUTH_HIDE_PASSWD);
#endif
if (count > 1)
{
char tmp[256];
sprintf (tmp, _("(try:%2d)"), count);
logprintf (LOG_NOTQUIET, "--%s-- %s %s\n",
tms, tmp, hurl);
}
else
{
logprintf (LOG_NOTQUIET, "--%s-- %s\n",
tms, hurl);
}
#ifndef WINDOWS
xfree (hurl);
#endif
}
#ifdef WINDOWS
ws_changetitle (hurl);
xfree (hurl);
}
}
#endif

/* Default document type is empty. However, if spider mode is
on or time-stamping is employed, HEAD_ONLY commands is
Expand Down
2 changes: 1 addition & 1 deletion src/retr.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ fd_read_body (const char *downloaded_filename, int fd, FILE *out, wgint toread,
if (progress)
progress_update (progress, ret, ptimer_read (timer));
#ifdef WINDOWS
if (toread > 0 && opt.show_progress)
if (toread > 0)
ws_percenttitle (100.0 *
(startpos + sum_read) / (startpos + toread));
#endif
Expand Down

0 comments on commit f3163c2

Please sign in to comment.