mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
Use Gnulib's quote function in ftp.c.
This commit is contained in:
parent
3b3c7db8df
commit
6aec825b93
@ -1,3 +1,8 @@
|
|||||||
|
2008-04-16 Steven Schubiger <schubiger@gmail.com>
|
||||||
|
|
||||||
|
* ftp.c: Use Gnulib's quote function for printing filenames and
|
||||||
|
such.
|
||||||
|
|
||||||
2008-04-16 Steven Schubiger <schubiger@gmail.com>
|
2008-04-16 Steven Schubiger <schubiger@gmail.com>
|
||||||
|
|
||||||
* sysdep.h: Comment the defines __EXTENSIONS__ and _GNU_SOURCE
|
* sysdep.h: Comment the defines __EXTENSIONS__ and _GNU_SOURCE
|
||||||
|
64
src/ftp.c
64
src/ftp.c
@ -566,8 +566,8 @@ Error in server response, closing control connection.\n"));
|
|||||||
return err;
|
return err;
|
||||||
case FTPNSFOD:
|
case FTPNSFOD:
|
||||||
logputs (LOG_VERBOSE, "\n");
|
logputs (LOG_VERBOSE, "\n");
|
||||||
logprintf (LOG_NOTQUIET, _("No such directory `%s'.\n\n"),
|
logprintf (LOG_NOTQUIET, _("No such directory %s.\n\n"),
|
||||||
escnonprint (u->dir));
|
quote (escnonprint (u->dir)));
|
||||||
fd_close (csock);
|
fd_close (csock);
|
||||||
con->csock = -1;
|
con->csock = -1;
|
||||||
return err;
|
return err;
|
||||||
@ -823,8 +823,8 @@ Error in server response, closing control connection.\n"));
|
|||||||
return err;
|
return err;
|
||||||
case FTPNSFOD:
|
case FTPNSFOD:
|
||||||
logputs (LOG_VERBOSE, "\n");
|
logputs (LOG_VERBOSE, "\n");
|
||||||
logprintf (LOG_NOTQUIET, _("No such file `%s'.\n\n"),
|
logprintf (LOG_NOTQUIET, _("No such file %s.\n\n"),
|
||||||
escnonprint (u->file));
|
quote (escnonprint (u->file)));
|
||||||
fd_close (dtsock);
|
fd_close (dtsock);
|
||||||
fd_close (local_sock);
|
fd_close (local_sock);
|
||||||
return err;
|
return err;
|
||||||
@ -870,8 +870,8 @@ Error in server response, closing control connection.\n"));
|
|||||||
return err;
|
return err;
|
||||||
case FTPNSFOD:
|
case FTPNSFOD:
|
||||||
logputs (LOG_VERBOSE, "\n");
|
logputs (LOG_VERBOSE, "\n");
|
||||||
logprintf (LOG_NOTQUIET, _("No such file or directory `%s'.\n\n"),
|
logprintf (LOG_NOTQUIET, _("No such file or directory %s.\n\n"),
|
||||||
".");
|
quote ("."));
|
||||||
fd_close (dtsock);
|
fd_close (dtsock);
|
||||||
fd_close (local_sock);
|
fd_close (local_sock);
|
||||||
return err;
|
return err;
|
||||||
@ -1094,7 +1094,7 @@ ftp_loop_internal (struct url *u, struct fileinfo *f, ccon *con)
|
|||||||
if (opt.noclobber && file_exists_p (con->target))
|
if (opt.noclobber && file_exists_p (con->target))
|
||||||
{
|
{
|
||||||
logprintf (LOG_VERBOSE,
|
logprintf (LOG_VERBOSE,
|
||||||
_("File `%s' already there; not retrieving.\n"), con->target);
|
_("File %s already there; not retrieving.\n"), quote (con->target));
|
||||||
/* If the file is there, we suppose it's retrieved OK. */
|
/* If the file is there, we suppose it's retrieved OK. */
|
||||||
return RETROK;
|
return RETROK;
|
||||||
}
|
}
|
||||||
@ -1165,8 +1165,8 @@ ftp_loop_internal (struct url *u, struct fileinfo *f, ccon *con)
|
|||||||
strcpy (tmp, " ");
|
strcpy (tmp, " ");
|
||||||
if (count > 1)
|
if (count > 1)
|
||||||
sprintf (tmp, _("(try:%2d)"), count);
|
sprintf (tmp, _("(try:%2d)"), count);
|
||||||
logprintf (LOG_VERBOSE, "--%s-- %s\n %s => `%s'\n",
|
logprintf (LOG_VERBOSE, "--%s-- %s\n %s => %s\n",
|
||||||
tms, hurl, tmp, locf);
|
tms, hurl, tmp, quote (locf));
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
ws_changetitle (hurl);
|
ws_changetitle (hurl);
|
||||||
#endif
|
#endif
|
||||||
@ -1234,8 +1234,8 @@ ftp_loop_internal (struct url *u, struct fileinfo *f, ccon *con)
|
|||||||
con->csock = -1;
|
con->csock = -1;
|
||||||
}
|
}
|
||||||
if (!opt.spider)
|
if (!opt.spider)
|
||||||
logprintf (LOG_VERBOSE, _("%s (%s) - `%s' saved [%s]\n\n"),
|
logprintf (LOG_VERBOSE, _("%s (%s) - %s saved [%s]\n\n"),
|
||||||
tms, tmrate, locf, number_to_static_string (len));
|
tms, tmrate, quote (locf), number_to_static_string (len));
|
||||||
if (!opt.verbose && !opt.quiet)
|
if (!opt.verbose && !opt.quiet)
|
||||||
{
|
{
|
||||||
/* Need to hide the password from the URL. The `if' is here
|
/* Need to hide the password from the URL. The `if' is here
|
||||||
@ -1318,7 +1318,7 @@ ftp_get_listing (struct url *u, ccon *con, struct fileinfo **f)
|
|||||||
uf = url_file_name (u);
|
uf = url_file_name (u);
|
||||||
lf = file_merge (uf, LIST_FILENAME);
|
lf = file_merge (uf, LIST_FILENAME);
|
||||||
xfree (uf);
|
xfree (uf);
|
||||||
DEBUGP ((_("Using `%s' as listing tmp file.\n"), lf));
|
DEBUGP ((_("Using %s as listing tmp file.\n"), quote (lf)));
|
||||||
|
|
||||||
con->target = lf;
|
con->target = lf;
|
||||||
err = ftp_loop_internal (u, NULL, con);
|
err = ftp_loop_internal (u, NULL, con);
|
||||||
@ -1333,7 +1333,7 @@ ftp_get_listing (struct url *u, ccon *con, struct fileinfo **f)
|
|||||||
if (unlink (lf))
|
if (unlink (lf))
|
||||||
logprintf (LOG_NOTQUIET, "unlink: %s\n", strerror (errno));
|
logprintf (LOG_NOTQUIET, "unlink: %s\n", strerror (errno));
|
||||||
else
|
else
|
||||||
logprintf (LOG_VERBOSE, _("Removed `%s'.\n"), lf);
|
logprintf (LOG_VERBOSE, _("Removed %s.\n"), quote (lf));
|
||||||
}
|
}
|
||||||
xfree (lf);
|
xfree (lf);
|
||||||
con->cmd &= ~DO_LIST;
|
con->cmd &= ~DO_LIST;
|
||||||
@ -1437,15 +1437,15 @@ ftp_retrieve_list (struct url *u, struct fileinfo *f, ccon *con)
|
|||||||
/* Remote file is older, file sizes can be compared and
|
/* Remote file is older, file sizes can be compared and
|
||||||
are both equal. */
|
are both equal. */
|
||||||
logprintf (LOG_VERBOSE, _("\
|
logprintf (LOG_VERBOSE, _("\
|
||||||
Remote file no newer than local file `%s' -- not retrieving.\n"), con->target);
|
Remote file no newer than local file %s -- not retrieving.\n"), quote (con->target));
|
||||||
dlthis = false;
|
dlthis = false;
|
||||||
}
|
}
|
||||||
else if (eq_size)
|
else if (eq_size)
|
||||||
{
|
{
|
||||||
/* Remote file is newer or sizes cannot be matched */
|
/* Remote file is newer or sizes cannot be matched */
|
||||||
logprintf (LOG_VERBOSE, _("\
|
logprintf (LOG_VERBOSE, _("\
|
||||||
Remote file is newer than local file `%s' -- retrieving.\n\n"),
|
Remote file is newer than local file %s -- retrieving.\n\n"),
|
||||||
con->target);
|
quote (con->target));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1503,8 +1503,8 @@ Already have correct symlink %s -> %s\n\n"),
|
|||||||
} /* have f->linkto */
|
} /* have f->linkto */
|
||||||
#else /* not HAVE_SYMLINK */
|
#else /* not HAVE_SYMLINK */
|
||||||
logprintf (LOG_NOTQUIET,
|
logprintf (LOG_NOTQUIET,
|
||||||
_("Symlinks not supported, skipping symlink `%s'.\n"),
|
_("Symlinks not supported, skipping symlink %s.\n"),
|
||||||
con->target);
|
quote (con->target));
|
||||||
#endif /* not HAVE_SYMLINK */
|
#endif /* not HAVE_SYMLINK */
|
||||||
}
|
}
|
||||||
else /* opt.retr_symlinks */
|
else /* opt.retr_symlinks */
|
||||||
@ -1515,8 +1515,8 @@ Already have correct symlink %s -> %s\n\n"),
|
|||||||
break;
|
break;
|
||||||
case FT_DIRECTORY:
|
case FT_DIRECTORY:
|
||||||
if (!opt.recursive)
|
if (!opt.recursive)
|
||||||
logprintf (LOG_NOTQUIET, _("Skipping directory `%s'.\n"),
|
logprintf (LOG_NOTQUIET, _("Skipping directory %s.\n"),
|
||||||
escnonprint (f->name));
|
quote (escnonprint (f->name)));
|
||||||
break;
|
break;
|
||||||
case FT_PLAINFILE:
|
case FT_PLAINFILE:
|
||||||
/* Call the retrieve loop. */
|
/* Call the retrieve loop. */
|
||||||
@ -1630,8 +1630,8 @@ ftp_retrieve_dirs (struct url *u, struct fileinfo *f, ccon *con)
|
|||||||
if (!accdir (newdir))
|
if (!accdir (newdir))
|
||||||
{
|
{
|
||||||
logprintf (LOG_VERBOSE, _("\
|
logprintf (LOG_VERBOSE, _("\
|
||||||
Not descending to `%s' as it is excluded/not-included.\n"),
|
Not descending to %s as it is excluded/not-included.\n"),
|
||||||
escnonprint (newdir));
|
quote (escnonprint (newdir)));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1695,8 +1695,8 @@ ftp_retrieve_glob (struct url *u, ccon *con, int action)
|
|||||||
{
|
{
|
||||||
if (f->type != FT_DIRECTORY && !acceptable (f->name))
|
if (f->type != FT_DIRECTORY && !acceptable (f->name))
|
||||||
{
|
{
|
||||||
logprintf (LOG_VERBOSE, _("Rejecting `%s'.\n"),
|
logprintf (LOG_VERBOSE, _("Rejecting %s.\n"),
|
||||||
escnonprint (f->name));
|
quote (escnonprint (f->name)));
|
||||||
f = delelement (f, &start);
|
f = delelement (f, &start);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1709,8 +1709,8 @@ ftp_retrieve_glob (struct url *u, ccon *con, int action)
|
|||||||
{
|
{
|
||||||
if (has_insecure_name_p (f->name))
|
if (has_insecure_name_p (f->name))
|
||||||
{
|
{
|
||||||
logprintf (LOG_VERBOSE, _("Rejecting `%s'.\n"),
|
logprintf (LOG_VERBOSE, _("Rejecting %s.\n"),
|
||||||
escnonprint (f->name));
|
quote (escnonprint (f->name)));
|
||||||
f = delelement (f, &start);
|
f = delelement (f, &start);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1773,8 +1773,8 @@ ftp_retrieve_glob (struct url *u, ccon *con, int action)
|
|||||||
/* No luck. */
|
/* No luck. */
|
||||||
/* #### This message SUCKS. We should see what was the
|
/* #### This message SUCKS. We should see what was the
|
||||||
reason that nothing was retrieved. */
|
reason that nothing was retrieved. */
|
||||||
logprintf (LOG_VERBOSE, _("No matches on pattern `%s'.\n"),
|
logprintf (LOG_VERBOSE, _("No matches on pattern %s.\n"),
|
||||||
escnonprint (u->file));
|
quote (escnonprint (u->file)));
|
||||||
}
|
}
|
||||||
else /* GLOB_GETONE or GLOB_GETALL */
|
else /* GLOB_GETONE or GLOB_GETALL */
|
||||||
{
|
{
|
||||||
@ -1839,13 +1839,13 @@ ftp_loop (struct url *u, int *dt, struct url *proxy, bool recursive, bool glob)
|
|||||||
else
|
else
|
||||||
sz = -1;
|
sz = -1;
|
||||||
logprintf (LOG_NOTQUIET,
|
logprintf (LOG_NOTQUIET,
|
||||||
_("Wrote HTML-ized index to `%s' [%s].\n"),
|
_("Wrote HTML-ized index to %s [%s].\n"),
|
||||||
filename, number_to_static_string (sz));
|
quote (filename), number_to_static_string (sz));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
logprintf (LOG_NOTQUIET,
|
logprintf (LOG_NOTQUIET,
|
||||||
_("Wrote HTML-ized index to `%s'.\n"),
|
_("Wrote HTML-ized index to %s.\n"),
|
||||||
filename);
|
quote (filename));
|
||||||
}
|
}
|
||||||
xfree (filename);
|
xfree (filename);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user