Use Gnulib's quote function in ftp.c.

This commit is contained in:
Steven Schubiger 2008-04-16 11:36:12 +02:00
parent 3b3c7db8df
commit 6aec825b93
2 changed files with 37 additions and 32 deletions

View File

@ -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>
* sysdep.h: Comment the defines __EXTENSIONS__ and _GNU_SOURCE

View File

@ -566,8 +566,8 @@ Error in server response, closing control connection.\n"));
return err;
case FTPNSFOD:
logputs (LOG_VERBOSE, "\n");
logprintf (LOG_NOTQUIET, _("No such directory `%s'.\n\n"),
escnonprint (u->dir));
logprintf (LOG_NOTQUIET, _("No such directory %s.\n\n"),
quote (escnonprint (u->dir)));
fd_close (csock);
con->csock = -1;
return err;
@ -823,8 +823,8 @@ Error in server response, closing control connection.\n"));
return err;
case FTPNSFOD:
logputs (LOG_VERBOSE, "\n");
logprintf (LOG_NOTQUIET, _("No such file `%s'.\n\n"),
escnonprint (u->file));
logprintf (LOG_NOTQUIET, _("No such file %s.\n\n"),
quote (escnonprint (u->file)));
fd_close (dtsock);
fd_close (local_sock);
return err;
@ -870,8 +870,8 @@ Error in server response, closing control connection.\n"));
return err;
case FTPNSFOD:
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 (local_sock);
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))
{
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. */
return RETROK;
}
@ -1165,8 +1165,8 @@ ftp_loop_internal (struct url *u, struct fileinfo *f, ccon *con)
strcpy (tmp, " ");
if (count > 1)
sprintf (tmp, _("(try:%2d)"), count);
logprintf (LOG_VERBOSE, "--%s-- %s\n %s => `%s'\n",
tms, hurl, tmp, locf);
logprintf (LOG_VERBOSE, "--%s-- %s\n %s => %s\n",
tms, hurl, tmp, quote (locf));
#ifdef WINDOWS
ws_changetitle (hurl);
#endif
@ -1234,8 +1234,8 @@ 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, locf, number_to_static_string (len));
logprintf (LOG_VERBOSE, _("%s (%s) - %s saved [%s]\n\n"),
tms, tmrate, quote (locf), number_to_static_string (len));
if (!opt.verbose && !opt.quiet)
{
/* 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);
lf = file_merge (uf, LIST_FILENAME);
xfree (uf);
DEBUGP ((_("Using `%s' as listing tmp file.\n"), lf));
DEBUGP ((_("Using %s as listing tmp file.\n"), quote (lf)));
con->target = lf;
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))
logprintf (LOG_NOTQUIET, "unlink: %s\n", strerror (errno));
else
logprintf (LOG_VERBOSE, _("Removed `%s'.\n"), lf);
logprintf (LOG_VERBOSE, _("Removed %s.\n"), quote (lf));
}
xfree (lf);
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
are both equal. */
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;
}
else if (eq_size)
{
/* Remote file is newer or sizes cannot be matched */
logprintf (LOG_VERBOSE, _("\
Remote file is newer than local file `%s' -- retrieving.\n\n"),
con->target);
Remote file is newer than local file %s -- retrieving.\n\n"),
quote (con->target));
}
else
{
@ -1503,8 +1503,8 @@ Already have correct symlink %s -> %s\n\n"),
} /* have f->linkto */
#else /* not HAVE_SYMLINK */
logprintf (LOG_NOTQUIET,
_("Symlinks not supported, skipping symlink `%s'.\n"),
con->target);
_("Symlinks not supported, skipping symlink %s.\n"),
quote (con->target));
#endif /* not HAVE_SYMLINK */
}
else /* opt.retr_symlinks */
@ -1515,8 +1515,8 @@ Already have correct symlink %s -> %s\n\n"),
break;
case FT_DIRECTORY:
if (!opt.recursive)
logprintf (LOG_NOTQUIET, _("Skipping directory `%s'.\n"),
escnonprint (f->name));
logprintf (LOG_NOTQUIET, _("Skipping directory %s.\n"),
quote (escnonprint (f->name)));
break;
case FT_PLAINFILE:
/* Call the retrieve loop. */
@ -1630,8 +1630,8 @@ ftp_retrieve_dirs (struct url *u, struct fileinfo *f, ccon *con)
if (!accdir (newdir))
{
logprintf (LOG_VERBOSE, _("\
Not descending to `%s' as it is excluded/not-included.\n"),
escnonprint (newdir));
Not descending to %s as it is excluded/not-included.\n"),
quote (escnonprint (newdir)));
continue;
}
@ -1695,8 +1695,8 @@ ftp_retrieve_glob (struct url *u, ccon *con, int action)
{
if (f->type != FT_DIRECTORY && !acceptable (f->name))
{
logprintf (LOG_VERBOSE, _("Rejecting `%s'.\n"),
escnonprint (f->name));
logprintf (LOG_VERBOSE, _("Rejecting %s.\n"),
quote (escnonprint (f->name)));
f = delelement (f, &start);
}
else
@ -1709,8 +1709,8 @@ ftp_retrieve_glob (struct url *u, ccon *con, int action)
{
if (has_insecure_name_p (f->name))
{
logprintf (LOG_VERBOSE, _("Rejecting `%s'.\n"),
escnonprint (f->name));
logprintf (LOG_VERBOSE, _("Rejecting %s.\n"),
quote (escnonprint (f->name)));
f = delelement (f, &start);
}
else
@ -1773,8 +1773,8 @@ ftp_retrieve_glob (struct url *u, ccon *con, int action)
/* No luck. */
/* #### This message SUCKS. We should see what was the
reason that nothing was retrieved. */
logprintf (LOG_VERBOSE, _("No matches on pattern `%s'.\n"),
escnonprint (u->file));
logprintf (LOG_VERBOSE, _("No matches on pattern %s.\n"),
quote (escnonprint (u->file)));
}
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
sz = -1;
logprintf (LOG_NOTQUIET,
_("Wrote HTML-ized index to `%s' [%s].\n"),
filename, number_to_static_string (sz));
_("Wrote HTML-ized index to %s [%s].\n"),
quote (filename), number_to_static_string (sz));
}
else
logprintf (LOG_NOTQUIET,
_("Wrote HTML-ized index to `%s'.\n"),
filename);
_("Wrote HTML-ized index to %s.\n"),
quote (filename));
}
xfree (filename);
}