mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
Move duplicated code to a function.
This commit is contained in:
parent
236ab6d8e0
commit
116b261a9f
@ -1,3 +1,12 @@
|
||||
2009-04-13 Steven Schubiger <stsc@member.fsf.org>
|
||||
|
||||
* ftp.c (ftp_retrieve_list): Move the duplicated code that
|
||||
determines the local file to a function.
|
||||
|
||||
* http.c (http_loop): Likewise.
|
||||
|
||||
* retr.c (set_local_file): New function.
|
||||
|
||||
2009-04-11 Steven Schubiger <stsc@member.fsf.org>
|
||||
|
||||
* init.c (initialize): Run a custom SYSTEM_WGETRC when
|
||||
|
10
src/ftp.c
10
src/ftp.c
@ -1590,16 +1590,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);
|
||||
}
|
||||
|
10
src/http.c
10
src/http.c
@ -2723,16 +2723,8 @@ Remote file exists.\n\n"));
|
||||
&& ((hstat.len == hstat.contlen) ||
|
||||
((hstat.res == 0) && (hstat.contlen == -1))))
|
||||
{
|
||||
/* #### 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 = hstat.local_file;
|
||||
set_local_file (&fl, hstat.local_file);
|
||||
if (fl)
|
||||
{
|
||||
time_t newtmr = -1;
|
||||
|
13
src/retr.c
13
src/retr.c
@ -1070,3 +1070,16 @@ no_proxy_match (const char *host, const char **no_proxy)
|
||||
else
|
||||
return sufmatch (no_proxy, host);
|
||||
}
|
||||
|
||||
/* Set the file parameter to point to the local file string. */
|
||||
void
|
||||
set_local_file (const char **file, const char *default_file)
|
||||
{
|
||||
if (opt.output_document)
|
||||
{
|
||||
if (output_stream_regular)
|
||||
*file = opt.output_document;
|
||||
}
|
||||
else
|
||||
*file = default_file;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user