/* File Transfer Protocol support.
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+ 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of GNU Wget.
This loop either gets commands from con, or (if ON_YOUR_OWN is
set), makes them up to retrieve the file given by the URL. */
static uerr_t
-ftp_loop_internal (struct url *u, struct fileinfo *f, ccon *con)
+ftp_loop_internal (struct url *u, struct fileinfo *f, ccon *con, char **local_file)
{
int count, orig_lp;
wgint restval, len = 0, qtyread = 0;
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"));
con->cmd |= LEAVE_PENDING;
else
con->cmd &= ~LEAVE_PENDING;
+
+ if (local_file)
+ *local_file = xstrdup (locf);
+
return RETROK;
} while (!opt.ntry || (count < opt.ntry));
con->target = xstrdup (lf);
xfree (lf);
- err = ftp_loop_internal (u, NULL, con);
+ err = ftp_loop_internal (u, NULL, con, NULL);
lf = xstrdup (con->target);
xfree (con->target);
con->target = old_target;
else /* opt.retr_symlinks */
{
if (dlthis)
- err = ftp_loop_internal (u, f, con);
+ err = ftp_loop_internal (u, f, con, NULL);
} /* opt.retr_symlinks */
break;
case FT_DIRECTORY:
case FT_PLAINFILE:
/* Call the retrieve loop. */
if (dlthis)
- err = ftp_loop_internal (u, f, con);
+ err = ftp_loop_internal (u, f, con, NULL);
break;
case FT_UNKNOWN:
logprintf (LOG_NOTQUIET, _("%s: unknown/unsupported file type.\n"),
{
/* Let's try retrieving it anyway. */
con->st |= ON_YOUR_OWN;
- res = ftp_loop_internal (u, NULL, con);
+ res = ftp_loop_internal (u, NULL, con, NULL);
return res;
}
of URL. Inherently, its capabilities are limited on what can be
encoded into a URL. */
uerr_t
-ftp_loop (struct url *u, int *dt, struct url *proxy, bool recursive, bool glob)
+ftp_loop (struct url *u, char **local_file, int *dt, struct url *proxy,
+ bool recursive, bool glob)
{
ccon con; /* FTP connection */
uerr_t res;
ispattern ? GLOB_GLOBALL : GLOB_GETONE);
}
else
- res = ftp_loop_internal (u, NULL, &con);
+ res = ftp_loop_internal (u, NULL, &con, local_file);
}
if (res == FTPOK)
res = RETROK;