X-Git-Url: http://sjero.net/git/?a=blobdiff_plain;f=src%2Fftp.c;h=171a38a44325a373f11c91cb659667226450f372;hb=94d6650817110c639975d45df57b345e10b0e396;hp=9f65cc340332957fed6968a2c7fd07b85a14fec5;hpb=8f5ffd9589d15c97ab91c494d9b511165f424c93;p=wget diff --git a/src/ftp.c b/src/ftp.c index 9f65cc34..171a38a4 100644 --- a/src/ftp.c +++ b/src/ftp.c @@ -1,6 +1,6 @@ /* File Transfer Protocol support. Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, - 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GNU Wget. @@ -69,6 +69,7 @@ typedef struct struct url *proxy; /* FTWK-style proxy */ } ccon; +extern int numurls; /* Look for regexp "( *[0-9]+ *byte" (literal parenthesis) anywhere in the string S, and return the number converted to wgint, if found, 0 @@ -1274,8 +1275,17 @@ ftp_loop_internal (struct url *u, struct fileinfo *f, ccon *con) con->csock = -1; } if (!opt.spider) - logprintf (LOG_VERBOSE, _("%s (%s) - %s saved [%s]\n\n"), - tms, tmrate, quote (locf), number_to_static_string (len)); + { + bool write_to_stdout = (opt.output_document && HYPHENP (opt.output_document)); + + logprintf (LOG_VERBOSE, + write_to_stdout + ? _("%s (%s) - written to stdout %s[%s]\n\n") + : _("%s (%s) - %s saved [%s]\n\n"), + tms, tmrate, + write_to_stdout ? "" : quote (locf), + number_to_static_string (len)); + } if (!opt.verbose && !opt.quiet) { /* Need to hide the password from the URL. The `if' is here @@ -1295,7 +1305,7 @@ ftp_loop_internal (struct url *u, struct fileinfo *f, ccon *con) number of bytes and files downloaded. */ { total_downloaded_bytes += len; - opt.numurls++; + numurls++; } /* Deletion of listing files is not controlled by --delete-after, but @@ -1310,7 +1320,7 @@ ftp_loop_internal (struct url *u, struct fileinfo *f, ccon *con) for instance, may want to know how many bytes and files they've downloaded through it. */ total_downloaded_bytes += len; - opt.numurls++; + numurls++; if (opt.delete_after) { @@ -1360,8 +1370,11 @@ ftp_get_listing (struct url *u, ccon *con, struct fileinfo **f) xfree (uf); DEBUGP ((_("Using %s as listing tmp file.\n"), quote (lf))); - con->target = lf; + con->target = xstrdup (lf); + xfree (lf); err = ftp_loop_internal (u, NULL, con); + lf = xstrdup (con->target); + xfree (con->target); con->target = old_target; if (err == RETROK) @@ -1580,16 +1593,8 @@ Already have correct symlink %s -> %s\n\n"), && dlthis && file_exists_p (con->target)) { - /* #### This code repeats in http.c and ftp.c. Move it to a - function! */ const char *fl = NULL; - if (opt.output_document) - { - if (output_stream_regular) - fl = opt.output_document; - } - else - fl = con->target; + set_local_file (&fl, con->target); if (fl) touch (fl, f->tstamp); }