X-Git-Url: http://sjero.net/git/?p=wget;a=blobdiff_plain;f=src%2Fftp.c;h=d58d67dfe87ff107ab59ed0b9c65c76f34356bb3;hp=7256faa360b24252906cf1f7a91394807bb74e88;hb=1df3a351069dae4614ef23af6a08aab6d94a5cfb;hpb=1859cd569b1fffe7c06a97b6fd3919d7aa598ce8 diff --git a/src/ftp.c b/src/ftp.c index 7256faa3..d58d67df 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 @@ -216,7 +217,7 @@ print_length (wgint size, wgint start, bool authoritative) logprintf (LOG_VERBOSE, " (%s)", human_readable (size)); if (start > 0) { - if (start >= 1024) + if (size - start >= 1024) logprintf (LOG_VERBOSE, _(", %s (%s) remaining"), number_to_static_string (size - start), human_readable (size - start)); @@ -805,8 +806,14 @@ Error in server response, closing control connection.\n")); } f = f->next; } - if (!exists) - { + if (exists) + { + logputs (LOG_VERBOSE, "\n"); + logprintf (LOG_NOTQUIET, _("File %s exists.\n"), + quote (u->file)); + } + else + { logputs (LOG_VERBOSE, "\n"); logprintf (LOG_NOTQUIET, _("No such file %s.\n"), quote (u->file)); @@ -1268,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 @@ -1289,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 @@ -1304,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) { @@ -1354,8 +1370,9 @@ 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); err = ftp_loop_internal (u, NULL, con); + xfree (con->target); con->target = old_target; if (err == RETROK) @@ -1574,16 +1591,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); }