Don't delete an input file fetched via FTP.

This commit is contained in:
Steven Schubiger 2010-03-04 22:09:31 +01:00
parent 33d8b23dfd
commit a801efcd96
4 changed files with 29 additions and 1 deletions

View File

@ -1,3 +1,12 @@
2010-03-04 Steven Schubiger <stsc@member.fsf.org>
* ftp.c (ftp_loop_internal): Omit input file from being
deleted after retrieval.
* retr.c (input_file_url): New function.
* retr.h: Add declaration for input_file_url.
2010-03-02 Steven Schubiger <stsc@member.fsf.org>
* retr.c (retrieve_from_file): Improve checking for a URL

View File

@ -1561,7 +1561,7 @@ ftp_loop_internal (struct url *u, struct fileinfo *f, ccon *con, char **local_fi
total_downloaded_bytes += qtyread;
numurls++;
if (opt.delete_after)
if (opt.delete_after && !input_file_url (opt.input_filename))
{
DEBUGP (("\
Removing file due to --delete-after in ftp_loop_internal():\n"));

View File

@ -1189,3 +1189,20 @@ set_local_file (const char **file, const char *default_file)
else
*file = default_file;
}
/* Return true for an input file's own URL, false otherwise. */
bool
input_file_url (const char *input_file)
{
static bool first = true;
if (input_file
&& url_has_scheme (input_file)
&& first)
{
first = false;
return true;
}
else
return false;
}

View File

@ -69,4 +69,6 @@ bool url_uses_proxy (struct url *);
void set_local_file (const char **, const char *);
bool input_file_url (const char *);
#endif /* RETR_H */