]> sjero.net Git - wget/commitdiff
Merge quote module stuff with current mainline.
authorMicah Cowan <micah@cowan.name>
Fri, 16 May 2008 02:13:08 +0000 (19:13 -0700)
committerMicah Cowan <micah@cowan.name>
Fri, 16 May 2008 02:13:08 +0000 (19:13 -0700)
1  2 
ChangeLog
NEWS
src/ChangeLog
src/Makefile.am
src/ftp.c
src/http.c
src/init.c
src/openssl.c
src/progress.c
src/utils.c

diff --combined ChangeLog
index 166fd30e10955bee1d1de1774ce2462027165649,f5b5d371647cca02e3c2c2dd847aff140f72cb00..a0a295d85ad6e83cd7811af2fc7b8c59db20eb78
+++ b/ChangeLog
@@@ -1,11 -1,21 +1,29 @@@
 +2008-05-12  Micah Cowan  <micah@cowan.name>
 +
 +      * NEWS: Translations and -N/-O.
 +
 +2008-04-30  Micah Cowan  <micah@cowan.name>
 +
 +      * NEWS: Added documentation for changes made in 1.11.2.
 +
+ 2008-04-14  Micah Cowan  <micah@cowan.name>
+       * GNUmakefile, lib/Makefile.am, lib/error.c, lib/error.h,
+       lib/exitfail.c, lib/exitfail.h, lib/getopt.c, lib/intprops.h,
+       lib/quote.c, lib/quote.h, lib/quotearg.c, lib/quotearg.h,
+       lib/stdlib.in.h, lib/strerror.c, lib/string.in.h,
+       lib/unistd.in.h, lib/wchar.in.h, lib/wctype.in.h,
+       lib/xalloc-die.c, lib/xalloc.h, lib/xmalloc.c, m4/error.m4,
+       m4/exitfail.m4, m4/extensions.m4, m4/gnulib-cache.m4,
+       m4/gnulib-comp.m4, m4/include_next.m4, m4/inline.m4,
+       m4/mbrtowc.m4, m4/mbstate_t.m4, m4/quote.m4, m4/quotearg.m4,
+       m4/stdlib_h.m4, m4/strerror.m4, m4/string_h.m4, m4/unistd_h.m4,
+       m4/wchar.m4, m4/wctype.m4, m4/wint_t.m4, m4/xalloc.m4,
+       md5/Makefile.am, md5/m4/gnulib-cache.m4, md5/m4/gnulib-comp.m4,
+       md5/m4/include_next.m4, md5/m4/md5.m4, md5/m4/stdint.m4,
+       md5/md5.c, md5/md5.h, md5/stdint.in.h, md5/wchar.in.h: Update
+       from Gnulib, and add the "quote" module.
  2008-03-20  Micah Cowan  <micah@cowan.name>
  
        * ABOUT-NLS: Reinstated, but with a message mentioning that
diff --combined NEWS
index 6b90b790f1b441531979b03103675342497d1194,b87f9d98cb4ac40337d1de416b124d6ceb2aa140..24a097c482bf6e7be6fdf7325b104411a9c5d145
--- 1/NEWS
--- 2/NEWS
+++ b/NEWS
@@@ -6,40 -6,12 +6,33 @@@ See the end for copying conditions
  
  Please send GNU Wget bug reports to <bug-wget@gnu.org>.
  \f
 -* Changes in Wget (MAINLINE).
 +* Changes in Wget 1.11.3
  
 -** Gnulib is now used to provide code for certain portability aspects in
 -GNU Wget.
 +** Downgraded -N with -O to a warning, rather than an error.
  
 -** Wget uses Automake now as part of its build infrastructure.
 +** Translation updates
 +\f
- * Changes in Wget (MAINLINE).
- ** Gnulib is now used to provide code for certain portability aspects in
- GNU Wget.
- ** Wget uses Automake now as part of its build infrastructure.
\f
 +* Changes in Wget 1.11.2
 +
 +** Fixed a problem in authenticating over HTTPS through a proxy.
 +(Regression in 1.11 over 1.10.2.)
 +
 +** The combination of -r or -p with -O, which was disallowed in 1.11,
 +has been downgraded to a warning in 1.11.2. (-O and -N, which was never
 +meaningful, is still an error.)
 +
 +** Further improvements to progress bar displays in non-English locales
 +(too many spaces could be inserted, causing the display to scroll).
 +
 +** Successive invocations of Wget on FTP URLS, with --no-remove-listing
 +and --continue, was causing Wget to append, rather than replace,
 +information in the .listing file, and thereby download the same files
 +multiple times. This has been fixed in 1.11.2.
 +
 +** Wget 1.11 no longer allowed ".." to persist at the beginning of URLs,
 +for improved conformance with RFC 3986. However, this behavior presents
 +problems for some FTP setups, and so they are now preserved again, for
 +FTP URLs only.
  \f
  * Changes in Wget 1.11.1.
  
diff --combined src/ChangeLog
index b8b466c06703b0a46404fc0ceb006609deedef01,c2db9da9a881daa0204c6c2ffd20845881e3c62d..f223d3593557a42dae456ceae2bfcd5b7108c689
+ 2008-05-14  Micah Cowan  <micah@cowan.name>
+       * ftp.c (ftp_retrieve_list): Symlinks and other filenames
+       should be fully quoted.
 +2008-05-12  Micah Cowan  <micah@cowan.name>
 +
 +      * main.c (main): Downgrade "-N with -O" to a warning, and switch
 +      it off to avoid confusing messages.
 +
 +2008-04-30  Micah Cowan  <micah@cowan.name>
 +
 +      * progress.c (create_image): Fix glitch where too many spaces are
 +      printed on lines that don't display the ETA, in multibyte
 +      locales.
 +
 +2008-04-27  Rabin Vincent  <rabin@rab.in>
 +
 +      * http.c (http_loop): Fix return for the case where we don't
 +      download a file because of -nc.
 +
 +2008-04-27  Micah Cowan  <micah@cowan.name>
 +
 +      * url.c (path_simplify): Go back to allowing leading ".." in
 +      paths, but only for FTP URLs.
 +      (test_path_simplify): Add scheme-specificness to tests, adapt for
 +      mu_run_test.
 +
 +      * test.c (all_tests): Add test_path_simplify.
 +
 +      * main.c (main): Downgrade -r, -p with -O to a warning rather than
 +      an error; elaborate just a bit more for other -O combination
 +      cases.
 +
 +2008-04-26  Micah Cowan  <micah@cowan.name>
 +
 +      * http.c (gethttp): Move proxy CONNECT handling to below the
 +      retry_with_auth label, to deal with properly reconnecting to
 +      proxies when we need to authenticate.
 +
 +2008-04-25  Micah Cowan  <micah@cowan.name>
 +
 +      * Makefile.am: -I foo -> -Ifoo.
 +
 +2008-04-23  Micah Cowan  <micah@cowan.name>
 +
 +      * utils.c (test_dir_matches_p): Added a test for the case
 +      described in issue #20518.
 +
 +2008-04-22  Jim Paris  <jim@jtan.com>
 +
 +      * openssl.c (ssl_init): Enable combined certificate/key in
 +      single file (apparent regression from ~1.9). Resolves issue
 +      #22767.
 +
 +2008-04-22  Steven Schubiger  <schubiger@gmail.com>
 +
 +      * http.c (print_response_line): Changed to make responses always
 +      be logged, even in --quiet mode, if --server-response was
 +      specified. This is to bring http.c's handling of the situation
 +      in line with ftp.c's.
 +
 +2008-04-22  Pranab Shenoy  <pranab.loosinit.shenoy@gmail.com>
 +
 +      * init.c: Added test_commands_sorted unit test to check is
 +      commands are sorted.  Fixes bug #21245.
 +
 +      * test.c: Added test_commands_sorted to the test suite.
 +
 +2008-04-22  Rabin Vincent  <rabin@rab.in>
 +
 +      * ftp.c (ftp_get_listing): Only remove .listing if it has been
 +      created. 
 +
 +2008-04-22  Alain Guibert  <alguibert+bts@free.fr>
 +
 +      * test.h (mu_run_test): Move declaration before statements, for
 +      C90 conformance. Fixes bug #22789.
 +
 +2008-04-22  Mike Frysinger  <vapier@gentoo.org>
 +
 +      * Makefile.am: Move @LIBS@ after other libraries, for better
 +      static-linking support. Fixes bug #22143.
 +
+ 2008-04-16  Steven Schubiger  <schubiger@gmail.com>
+       * ftp.c: Use Gnulib's quote function for printing filenames and
+       such.
+       * connect.c: Likewise.
+       * convert.c: Likewise.
+       * cookies.c: Likewise.
+       * ftp-opie.c: Likewise.
+       * gnutls.c: Likewise.
+       * init.c: Likewise.
+       * log.c: Likewise.
+       * mswindows.c: Likewise.
+       * openssl.c: Likewise.
+       * progress.c: Likewise.
+       * recur.c: Likewise.
+       * res.c: Likewise.
+       * utils.c: Likewise.
+ 2008-04-16  Steven Schubiger  <schubiger@gmail.com>
+       * sysdep.h: Comment the defines __EXTENSIONS__ and _GNU_SOURCE 
+       out, because they're now defined independently by config.h.
+ 2008-04-14  Steven Schubiger  <schubiger@gmail.com>
+       * http.c: Use Gnulib's quote function for printing filenames and
+       such.
+       * wget.h: #include "quote.h".
  2008-04-12  Rabin Vincent  <rabin@rab.in>
  
        * mswindows.c (fake_fork_child): Don't create a logfile for
diff --combined src/Makefile.am
index d91ee764e92b1440c184f9dc1bcde66db64d8f7a,4b351204dfb93b8190ca19b30892fdeea9d8176a..451754914cb07dc09c58183c7c383ac621e09b04
  
  # The following line is losing on some versions of make!
  DEFS     = @DEFS@ -DSYSTEM_WGETRC=\"$(sysconfdir)/wgetrc\" -DLOCALEDIR=\"$(localedir)\"
 -LIBS     = @LIBS@ @LIBSSL@ @LIBGNUTLS@ @LIBINTL@
 +LIBS     = @LIBSSL@ @LIBGNUTLS@ @LIBINTL@ @LIBS@
  
  bin_PROGRAMS = wget
  wget_SOURCES = cmpt.c connect.c convert.c cookies.c ftp.c ftp-basic.c \
               ftp-ls.c hash.c host.c html-parse.c html-url.c http.c    \
               init.c log.c main.c netrc.c progress.c ptimer.c recur.c  \
               res.c retr.c snprintf.c spider.c url.c   \
-              utils.c xmalloc.c                                \
+              utils.c                          \
               connect.h convert.h cookies.h            \
               ftp.h gen-md5.h hash.h host.h html-parse.h \
               http.h http-ntlm.h init.h log.h mswindows.h netrc.h \
               options.h progress.h ptimer.h recur.h res.h retr.h \
-              spider.h ssl.h sysdep.h url.h utils.h wget.h xmalloc.h
+              spider.h ssl.h sysdep.h url.h utils.h wget.h
  nodist_wget_SOURCES = version.c
  EXTRA_wget_SOURCES = mswindows.c
- LDADD = $(ALLOCA) $(LIBOBJS) ../lib/libgnu.a @MD5_LDADD@
+ LDADD = $(LIBOBJS) ../lib/libgnu.a @MD5_LDADD@
 -AM_CPPFLAGS = -I $(top_srcdir)/lib @MD5_CPPFLAGS@
 +AM_CPPFLAGS = -I$(top_srcdir)/lib @MD5_CPPFLAGS@
  
  version.c:  $(wget_SOURCES) $(LDADD) $(srcdir)/Makefile.am
        echo 'const char *version_string = "@VERSION@"' > $@
@@@ -59,6 -59,6 +59,6 @@@ check_LIBRARIES = libunittest.
  libunittest_a_SOURCES = $(wget_SOURCES) test.c test.h
  nodist_libunittest_a_SOURCES = version.c
  libunittest_a_CPPFLAGS = -DTESTING -I$(top_srcdir)/lib
- libunittest_a_LIBADD = $(ALLOCA) $(LIBOBJS)
+ libunittest_a_LIBADD = $(LIBOBJS)
  
  CLEANFILES = *~ *.bak core core.[0-9]* version.c
diff --combined src/ftp.c
index 5a9ecc6a694969a054c1c33560bbfc913b623f20,59ba1c1669a6907a130e325e3ead32e30e9e77ae..0ecc6bcb1dafbb417ed12922f75b3f433e83a812
+++ b/src/ftp.c
@@@ -300,7 -300,8 +300,8 @@@ getftp (struct url *u, wgint *len, wgin
          con->csock = -1;
  
        /* Second: Login with proper USER/PASS sequence.  */
-       logprintf (LOG_VERBOSE, _("Logging in as %s ... "), escnonprint (user));
+       logprintf (LOG_VERBOSE, _("Logging in as %s ... "), 
+                  quotearg_style (escape_quoting_style, user));
        if (opt.server_response)
          logputs (LOG_ALWAYS, "\n");
        err = ftp_login (csock, logname, passwd);
@@@ -545,7 -546,8 +546,8 @@@ Error in server response, closing contr
              }
  
            if (!opt.server_response)
-             logprintf (LOG_VERBOSE, "==> CWD %s ... ", escnonprint (target));
+             logprintf (LOG_VERBOSE, "==> CWD %s ... ", 
+                        quotearg_style (escape_quoting_style, target));
            err = ftp_cwd (csock, target);
            /* FTPRERR, WRITEFAILED, FTPNSFOD */
            switch (err)
@@@ -566,8 -568,8 +568,8 @@@ Error in server response, closing contr
                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 (u->dir));
                fd_close (csock);
                con->csock = -1;
                return err;
        if (opt.verbose)
          {
            if (!opt.server_response)
-             logprintf (LOG_VERBOSE, "==> SIZE %s ... ", escnonprint (u->file));
+             logprintf (LOG_VERBOSE, "==> SIZE %s ... ", 
+                        quotearg_style (escape_quoting_style, u->file));
          }
  
        err = ftp_size (csock, u->file, len);
@@@ -795,7 -798,8 +798,8 @@@ Error in server response, closing contr
              {
                if (restval)
                  logputs (LOG_VERBOSE, "\n");
-               logprintf (LOG_VERBOSE, "==> RETR %s ... ", escnonprint (u->file));
+               logprintf (LOG_VERBOSE, "==> RETR %s ... ", 
+                          quotearg_style (escape_quoting_style, u->file));
              }
          }
  
@@@ -823,8 -827,8 +827,8 @@@ Error in server response, closing contr
            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 (u->file));
            fd_close (dtsock);
            fd_close (local_sock);
            return err;
@@@ -870,8 -874,8 +874,8 @@@ Error in server response, closing contr
            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;
                char *p = strchr (line, '\0');
                while (p > line && (p[-1] == '\n' || p[-1] == '\r'))
                  *--p = '\0';
-               logprintf (LOG_ALWAYS, "%s\n", escnonprint (line));
+               logprintf (LOG_ALWAYS, "%s\n", 
+                          quotearg_style (escape_quoting_style, line));
                xfree (line);
              }
            fclose (fp);
@@@ -1094,7 -1099,7 +1099,7 @@@ ftp_loop_internal (struct url *u, struc
    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;
      }
            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
            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,25 -1323,23 +1323,25 @@@ ftp_get_listing (struct url *u, ccon *c
    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);
    con->target = old_target;
  
    if (err == RETROK)
 -    *f = ftp_parse_ls (lf, con->rs);
 -  else
 -    *f = NULL;
 -  if (opt.remove_listing)
      {
 -      if (unlink (lf))
 -        logprintf (LOG_NOTQUIET, "unlink: %s\n", strerror (errno));
 -      else
 -        logprintf (LOG_VERBOSE, _("Removed %s.\n"), quote (lf));
 +      *f = ftp_parse_ls (lf, con->rs);
 +      if (opt.remove_listing)
 +        {
 +          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));
 +        }
      }
 +  else
 +    *f = NULL;
    xfree (lf);
    con->cmd &= ~DO_LIST;
    return err;
@@@ -1439,15 -1442,15 +1444,15 @@@ ftp_retrieve_list (struct url *u, struc
                    /* 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
                  {
@@@ -1489,14 -1492,15 +1494,15 @@@ The sizes do not match (local %s) -- re
                              {
                                logprintf (LOG_VERBOSE, _("\
  Already have correct symlink %s -> %s\n\n"),
-                                          con->target, escnonprint (f->linkto));
+                                          quote (con->target),
+                                          quote (f->linkto));
                                dlthis = false;
                                break;
                              }
                          }
                      }
                    logprintf (LOG_VERBOSE, _("Creating symlink %s -> %s\n"),
-                              con->target, escnonprint (f->linkto));
+                              quote (con->target), quote (f->linkto));
                    /* Unlink before creating symlink!  */
                    unlink (con->target);
                    if (symlink (f->linkto, con->target) == -1)
                  } /* 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 */
            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 (f->name));
            break;
          case FT_PLAINFILE:
            /* Call the retrieve loop.  */
            break;
          case FT_UNKNOWN:
            logprintf (LOG_NOTQUIET, _("%s: unknown/unsupported file type.\n"),
-                      escnonprint (f->name));
+                      quote (f->name));
            break;
          }       /* switch */
  
@@@ -1632,8 -1636,8 +1638,8 @@@ ftp_retrieve_dirs (struct url *u, struc
        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 (newdir));
            continue;
          }
  
@@@ -1697,8 -1701,8 +1703,8 @@@ ftp_retrieve_glob (struct url *u, ccon 
          {
            if (f->type != FT_DIRECTORY && !acceptable (f->name))
              {
-               logprintf (LOG_VERBOSE, _("Rejecting `%s'.\n"),
-                          escnonprint (f->name));
+               logprintf (LOG_VERBOSE, _("Rejecting %s.\n"),
+                          quote (f->name));
                f = delelement (f, &start);
              }
            else
      {
        if (has_insecure_name_p (f->name))
          {
-           logprintf (LOG_VERBOSE, _("Rejecting `%s'.\n"),
-                      escnonprint (f->name));
+           logprintf (LOG_VERBOSE, _("Rejecting %s.\n"),
+                      quote (f->name));
            f = delelement (f, &start);
          }
        else
                if (matchres == -1)
                  {
                    logprintf (LOG_NOTQUIET, _("Error matching %s against %s: %s\n"),
-                              u->file, escnonprint (f->name), strerror (errno));
+                              u->file, quotearg_style (escape_quoting_style, f->name), 
+                              strerror (errno));
                    break;
                  }
                if (matchres == FNM_NOMATCH)
            /* 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 (u->file));
          }
        else /* GLOB_GETONE or GLOB_GETALL */
          {
@@@ -1841,13 -1846,13 +1848,13 @@@ ftp_loop (struct url *u, int *dt, struc
                        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);
              }
diff --combined src/http.c
index 129359cad47e183a01d89ae1aeb25b32b0a6ee3e,5b04fe4a59ef82db67996c9d8c95bfc0ba85cbcc..0252d3421f07f491a59c443f50ab08aa6480d2af
@@@ -403,13 -403,13 +403,13 @@@ maybe_send_basic_creds (const char *hos
    else if (basic_authed_hosts
        && hash_table_contains(basic_authed_hosts, hostname))
      {
-       DEBUGP(("Found `%s' in basic_authed_hosts.\n", hostname));
+       DEBUGP(("Found %s in basic_authed_hosts.\n", quote (hostname)));
        do_challenge = true;
      }
    else
      {
-       DEBUGP(("Host `%s' has not issued a general basic challenge.\n",
-               hostname));
+       DEBUGP(("Host %s has not issued a general basic challenge.\n",
+               quote (hostname)));
      }
    if (do_challenge)
      {
@@@ -430,7 -430,7 +430,7 @@@ register_basic_auth_host (const char *h
    if (!hash_table_contains(basic_authed_hosts, hostname))
      {
        hash_table_put (basic_authed_hosts, xstrdup(hostname), NULL);
-       DEBUGP(("Inserted `%s' into basic_authed_hosts\n", hostname));
+       DEBUGP(("Inserted %s into basic_authed_hosts\n", quote (hostname)));
      }
  }
  
@@@ -810,7 -810,8 +810,8 @@@ print_response_line(const char *prefix
  {
    char *copy;
    BOUNDED_TO_ALLOCA(b, e, copy);
-   logprintf (LOG_ALWAYS, "%s%s\n", prefix, escnonprint(copy));
 -  logprintf (LOG_VERBOSE, "%s%s\n", prefix, 
++  logprintf (LOG_ALWAYS, "%s%s\n", prefix, 
+              quotearg_style (escape_quoting_style, copy));
  }
  
  /* Print the server response, line by line, omitting the trailing CRLF
@@@ -1497,6 -1498,41 +1498,6 @@@ gethttp (struct url *u, struct http_sta
        basic_auth_finished = maybe_send_basic_creds(u->host, user, passwd, req);
      }
  
 -  proxyauth = NULL;
 -  if (proxy)
 -    {
 -      char *proxy_user, *proxy_passwd;
 -      /* For normal username and password, URL components override
 -         command-line/wgetrc parameters.  With proxy
 -         authentication, it's the reverse, because proxy URLs are
 -         normally the "permanent" ones, so command-line args
 -         should take precedence.  */
 -      if (opt.proxy_user && opt.proxy_passwd)
 -        {
 -          proxy_user = opt.proxy_user;
 -          proxy_passwd = opt.proxy_passwd;
 -        }
 -      else
 -        {
 -          proxy_user = proxy->user;
 -          proxy_passwd = proxy->passwd;
 -        }
 -      /* #### This does not appear right.  Can't the proxy request,
 -         say, `Digest' authentication?  */
 -      if (proxy_user && proxy_passwd)
 -        proxyauth = basic_authentication_encode (proxy_user, proxy_passwd);
 -
 -      /* If we're using a proxy, we will be connecting to the proxy
 -         server.  */
 -      conn = proxy;
 -
 -      /* Proxy authorization over SSL is handled below. */
 -#ifdef HAVE_SSL
 -      if (u->scheme != SCHEME_HTTPS)
 -#endif
 -        request_set_header (req, "Proxy-Authorization", proxyauth, rel_value);
 -    }
 -
    /* Generate the Host header, HOST:PORT.  Take into account that:
  
       - Broken server-side software often doesn't recognize the PORT
            post_data_size = file_size (opt.post_file_name);
            if (post_data_size == -1)
              {
-               logprintf (LOG_NOTQUIET, _("POST data file `%s' missing: %s\n"),
-                          opt.post_file_name, strerror (errno));
+               logprintf (LOG_NOTQUIET, _("POST data file %s missing: %s\n"),
+                          quote (opt.post_file_name), strerror (errno));
                post_data_size = 0;
              }
          }
       without authorization header fails.  (Expected to happen at least
       for the Digest authorization scheme.)  */
  
 +  proxyauth = NULL;
 +  if (proxy)
 +    {
 +      char *proxy_user, *proxy_passwd;
 +      /* For normal username and password, URL components override
 +         command-line/wgetrc parameters.  With proxy
 +         authentication, it's the reverse, because proxy URLs are
 +         normally the "permanent" ones, so command-line args
 +         should take precedence.  */
 +      if (opt.proxy_user && opt.proxy_passwd)
 +        {
 +          proxy_user = opt.proxy_user;
 +          proxy_passwd = opt.proxy_passwd;
 +        }
 +      else
 +        {
 +          proxy_user = proxy->user;
 +          proxy_passwd = proxy->passwd;
 +        }
 +      /* #### This does not appear right.  Can't the proxy request,
 +         say, `Digest' authentication?  */
 +      if (proxy_user && proxy_passwd)
 +        proxyauth = basic_authentication_encode (proxy_user, proxy_passwd);
 +
 +      /* If we're using a proxy, we will be connecting to the proxy
 +         server.  */
 +      conn = proxy;
 +
 +      /* Proxy authorization over SSL is handled below. */
 +#ifdef HAVE_SSL
 +      if (u->scheme != SCHEME_HTTPS)
 +#endif
 +        request_set_header (req, "Proxy-Authorization", proxyauth, rel_value);
 +    }
 +
    keep_alive = false;
  
    /* Establish the connection.  */
            sock = pconn.socket;
            using_ssl = pconn.ssl;
            logprintf (LOG_VERBOSE, _("Reusing existing connection to %s:%d.\n"),
-                      escnonprint (pconn.host), pconn.port);
+                      quotearg_style (escape_quoting_style, pconn.host), 
+                      pconn.port);
            DEBUGP (("Reusing fd %d.\n", sock));
            if (pconn.authorized)
              /* If the connection is already authorized, the "Basic"
          {
            request_free (req);
            logprintf(LOG_NOTQUIET,
-                     _("%s: unable to resolve host address `%s'\n"),
-                     exec_name, relevant->host);
+                     _("%s: unable to resolve host address %s\n"),
+                     exec_name, quote (relevant->host));
            return HOSTERR;
          }
      }
              {
              failed_tunnel:
                logprintf (LOG_NOTQUIET, _("Proxy tunneling failed: %s"),
-                          message ? escnonprint (message) : "?");
+                          message ? quotearg_style (escape_quoting_style, message) : "?");
                xfree_null (message);
                return CONSSLERR;
              }
    statcode = resp_status (resp, &message);
    if (!opt.server_response)
      logprintf (LOG_VERBOSE, "%2d %s\n", statcode,
-                message ? escnonprint (message) : "");
+                message ? quotearg_style (escape_quoting_style, message) : "");
    else
      {
        logprintf (LOG_VERBOSE, "\n");
            /* If opt.noclobber is turned on and file already exists, do not
               retrieve the file */
            logprintf (LOG_VERBOSE, _("\
- File `%s' already there; not retrieving.\n\n"), hs->local_file);
+ File %s already there; not retrieving.\n\n"), quote (hs->local_file));
            /* If the file is there, we suppose it's retrieved OK.  */
            *dt |= RETROKF;
  
              logputs (LOG_VERBOSE,
                       opt.ignore_length ? _("ignored") : _("unspecified"));
            if (type)
-             logprintf (LOG_VERBOSE, " [%s]\n", escnonprint (type));
+             logprintf (LOG_VERBOSE, " [%s]\n", quotearg_style (escape_quoting_style, type));
            else
              logputs (LOG_VERBOSE, "\n");
          }
    /* Print fetch message, if opt.verbose.  */
    if (opt.verbose)
      {
-       logprintf (LOG_NOTQUIET, _("Saving to: `%s'\n"), 
-                  HYPHENP (hs->local_file) ? "STDOUT" : hs->local_file);
+       logprintf (LOG_NOTQUIET, _("Saving to: %s\n"), 
+                  HYPHENP (hs->local_file) ? quote ("STDOUT") : quote (hs->local_file));
      }
      
    /* This confuses the timestamping code that checks for file size.
@@@ -2379,8 -2381,8 +2381,8 @@@ http_loop (struct url *u, char **newloc
        /* If opt.noclobber is turned on and file already exists, do not
           retrieve the file */
        logprintf (LOG_VERBOSE, _("\
- File `%s' already there; not retrieving.\n\n"), 
-                  hstat.local_file);
+ File %s already there; not retrieving.\n\n"), 
+                  quote (hstat.local_file));
        /* If the file is there, we suppose it's retrieved OK.  */
        *dt |= RETROKF;
  
        if (has_html_suffix_p (hstat.local_file))
          *dt |= TEXTHTML;
  
 -      return RETRUNNEEDED;
 +      ret = RETROK;
 +      goto exit;
      }
  
    /* Reset the counter. */
@@@ -2508,8 -2509,8 +2510,8 @@@ Spider mode enabled. Check if remote fi
          case FWRITEERR: case FOPENERR:
            /* Another fatal error.  */
            logputs (LOG_VERBOSE, "\n");
-           logprintf (LOG_NOTQUIET, _("Cannot write to `%s' (%s).\n"),
-                      hstat.local_file, strerror (errno));
+           logprintf (LOG_NOTQUIET, _("Cannot write to %s (%s).\n"),
+                      quote (hstat.local_file), strerror (errno));
          case HOSTERR: case CONIMPOSSIBLE: case PROXERR: case AUTHFAILED: 
          case SSLINITFAILED: case CONTNOTSUPPORTED:
            /* Fatal errors just return from the function.  */
@@@ -2577,7 -2578,8 +2579,8 @@@ Remote file does not exist -- broken li
            else
              {
                logprintf (LOG_NOTQUIET, _("%s ERROR %d: %s.\n"),
-                          tms, hstat.statcode, escnonprint (hstat.error));
+                          tms, hstat.statcode, 
+                          quotearg_style (escape_quoting_style, hstat.error));
              }
            logputs (LOG_VERBOSE, "\n");
            ret = WRONGCODE;
@@@ -2631,8 -2633,8 +2634,8 @@@ Last-modified header invalid -- time-st
                                    || hstat.orig_file_size == hstat.contlen)
                                  {
                                    logprintf (LOG_VERBOSE, _("\
- Server file no newer than local file `%s' -- not retrieving.\n\n"),
-                                              hstat.orig_file_name);
+ Server file no newer than local file %s -- not retrieving.\n\n"),
+                                              quote (hstat.orig_file_name));
                                    ret = RETROK;
                                    goto exit;
                                  }
@@@ -2735,8 -2737,8 +2738,8 @@@ Remote file exists.\n\n"))
            if (*dt & RETROKF)
              {
                logprintf (LOG_VERBOSE,
-                          _("%s (%s) - `%s' saved [%s/%s]\n\n"),
-                          tms, tmrate, hstat.local_file,
+                          _("%s (%s) - %s saved [%s/%s]\n\n"),
+                          tms, tmrate, quote (hstat.local_file),
                           number_to_static_string (hstat.len),
                           number_to_static_string (hstat.contlen));
                logprintf (LOG_NONVERBOSE,
                if (*dt & RETROKF)
                  {
                    logprintf (LOG_VERBOSE,
-                              _("%s (%s) - `%s' saved [%s]\n\n"),
-                              tms, tmrate, hstat.local_file,
+                              _("%s (%s) - %s saved [%s]\n\n"),
+                              tms, tmrate, quote (hstat.local_file),
                               number_to_static_string (hstat.len));
                    logprintf (LOG_NONVERBOSE,
                               "%s URL:%s [%s] -> \"%s\" [%d]\n",
diff --combined src/init.c
index ab86c781eb86b2857303d6bf16b750e4ae155ac4,e079df95d12d1b2ac4afd24fb98df1a035260a51..fcb7c2ccbd8254c9a680ff8d536a13d891cb2a75
@@@ -478,8 -478,8 +478,8 @@@ run_wgetrc (const char *file
            ++errcnt;
            break;
          case line_unknown_command:
-           fprintf (stderr, _("%s: Unknown command `%s' in %s at line %d.\n"),
-                    exec_name, com, file, ln);
+           fprintf (stderr, _("%s: Unknown command %s in %s at line %d.\n"),
+                    exec_name, quote (com), file, ln);
            ++errcnt;
            break;
          case line_empty:
@@@ -524,8 -524,8 +524,8 @@@ initialize (void
    if (!strcmp (file, SYSTEM_WGETRC))
      {
        fprintf (stderr, _("\
- %s: Warning: Both system and user wgetrc point to `%s'.\n"),
-                exec_name, file);
+ %s: Warning: Both system and user wgetrc point to %s.\n"),
+                exec_name, quote (file));
      }
    else
  #endif
@@@ -676,8 -676,8 +676,8 @@@ run_command (const char *opt
        xfree (val);
        break;
      default:
-       fprintf (stderr, _("%s: Invalid --execute command `%s'\n"),
-                exec_name, opt);
+       fprintf (stderr, _("%s: Invalid --execute command %s\n"),
+                exec_name, quote (opt));
        exit (2);
      }
  }
@@@ -721,8 -721,8 +721,8 @@@ cmd_boolean (const char *com, const cha
    else
      {
        fprintf (stderr,
-                _("%s: %s: Invalid boolean `%s'; use `on' or `off'.\n"),
-                exec_name, com, val);
+                _("%s: %s: Invalid boolean %s; use `on' or `off'.\n"),
+                exec_name, com, quote (val));
        return false;
      }
  
@@@ -738,8 -738,8 +738,8 @@@ cmd_number (const char *com, const cha
    if (!simple_atoi (val, val + strlen (val), place)
        || *(int *) place < 0)
      {
-       fprintf (stderr, _("%s: %s: Invalid number `%s'.\n"),
-                exec_name, com, val);
+       fprintf (stderr, _("%s: %s: Invalid number %s.\n"),
+                exec_name, com, quote (val));
        return false;
      }
    return true;
@@@ -969,8 -969,8 +969,8 @@@ cmd_bytes (const char *com, const char 
    double byte_value;
    if (!parse_bytes_helper (val, &byte_value))
      {
-       fprintf (stderr, _("%s: %s: Invalid byte value `%s'\n"),
-                exec_name, com, val);
+       fprintf (stderr, _("%s: %s: Invalid byte value %s\n"),
+                exec_name, com, quote (val));
        return false;
      }
    *(wgint *)place = (wgint)byte_value;
@@@ -988,8 -988,8 +988,8 @@@ cmd_bytes_sum (const char *com, const c
    double byte_value;
    if (!parse_bytes_helper (val, &byte_value))
      {
-       fprintf (stderr, _("%s: %s: Invalid byte value `%s'\n"),
-                exec_name, com, val);
+       fprintf (stderr, _("%s: %s: Invalid byte value %s\n"),
+                exec_name, com, quote (val));
        return false;
      }
    *(SUM_SIZE_INT *) place = (SUM_SIZE_INT) byte_value;
@@@ -1013,8 -1013,8 +1013,8 @@@ cmd_time (const char *com, const char *
    if (val == end)
      {
      err:
-       fprintf (stderr, _("%s: %s: Invalid time period `%s'\n"),
-                exec_name, com, val);
+       fprintf (stderr, _("%s: %s: Invalid time period %s\n"),
+                exec_name, com, quote (val));
        return false;
      }
  
@@@ -1067,7 -1067,7 +1067,7 @@@ cmd_cert_type (const char *com, const c
    };
    int ok = decode_string (val, choices, countof (choices), place);
    if (!ok)
-     fprintf (stderr, _("%s: %s: Invalid value `%s'.\n"), exec_name, com, val);
+     fprintf (stderr, _("%s: %s: Invalid value %s.\n"), exec_name, com, quote (val));
    return ok;
  }
  #endif
@@@ -1104,8 -1104,8 +1104,8 @@@ cmd_spec_header (const char *com, cons
  
    if (!check_user_specified_header (val))
      {
-       fprintf (stderr, _("%s: %s: Invalid header `%s'.\n"),
-                exec_name, com, val);
+       fprintf (stderr, _("%s: %s: Invalid header %s.\n"),
+                exec_name, com, quote (val));
        return false;
      }
    opt.user_headers = vec_append (opt.user_headers, val);
@@@ -1157,7 -1157,7 +1157,7 @@@ cmd_spec_prefer_family (const char *com
    int prefer_family = prefer_ipv4;
    int ok = decode_string (val, choices, countof (choices), &prefer_family);
    if (!ok)
-     fprintf (stderr, _("%s: %s: Invalid value `%s'.\n"), exec_name, com, val);
+     fprintf (stderr, _("%s: %s: Invalid value %s.\n"), exec_name, com, quote (val));
    opt.prefer_family = prefer_family;
    return ok;
  }
@@@ -1170,8 -1170,8 +1170,8 @@@ cmd_spec_progress (const char *com, con
  {
    if (!valid_progress_implementation_p (val))
      {
-       fprintf (stderr, _("%s: %s: Invalid progress type `%s'.\n"),
-                exec_name, com, val);
+       fprintf (stderr, _("%s: %s: Invalid progress type %s.\n"),
+                exec_name, com, quote (val));
        return false;
      }
    xfree_null (opt.progress_type);
@@@ -1229,8 -1229,8 +1229,8 @@@ cmd_spec_restrict_file_names (const cha
        else
          {
            fprintf (stderr,
-                    _("%s: %s: Invalid restriction `%s', use [unix|windows],[lowercase|uppercase],[nocontrol].\n"),
-                    exec_name, com, val);
+                    _("%s: %s: Invalid restriction %s, use [unix|windows],[lowercase|uppercase],[nocontrol].\n"),
+                    exec_name, com, quote (val));
            return false;
          }
  
@@@ -1260,7 -1260,7 +1260,7 @@@ cmd_spec_secure_protocol (const char *c
    };
    int ok = decode_string (val, choices, countof (choices), place);
    if (!ok)
-     fprintf (stderr, _("%s: %s: Invalid value `%s'.\n"), exec_name, com, val);
+     fprintf (stderr, _("%s: %s: Invalid value %s.\n"), exec_name, com, quote (val));
    return ok;
  }
  #endif
@@@ -1285,8 -1285,8 +1285,8 @@@ cmd_spec_useragent (const char *com, co
    /* Disallow embedded newlines.  */
    if (strchr (val, '\n'))
      {
-       fprintf (stderr, _("%s: %s: Invalid value `%s'.\n"),
-                exec_name, com, val);
+       fprintf (stderr, _("%s: %s: Invalid value %s.\n"),
+                exec_name, com, quote (val));
        return false;
      }
    xfree_null (opt.useragent);
@@@ -1530,29 -1530,6 +1530,29 @@@ cleanup (void
  
  #ifdef TESTING
  
 +const char *
 +test_commands_sorted()
 +{
 +  int prev_idx = 0, next_idx = 1;
 +  int command_count = countof (commands) - 1;
 +  int cmp = 0;
 +  while (next_idx <= command_count)
 +    {
 +      cmp = strcasecmp (commands[prev_idx].name, commands[next_idx].name);
 +      if (cmp > 0)
 +        {
 +          mu_assert ("FAILED", false);
 +          break;
 +        }     
 +      else
 +        { 
 +          prev_idx ++;
 +        next_idx ++;
 +        }
 +    }
 +  return NULL;
 +}
 +
  const char *
  test_cmd_spec_restrict_file_names()
  {
diff --combined src/openssl.c
index 1f19a6f6d4b0a40c6cfe6501bfdeef5480d4336b,8a5cc0edd6f77a6b43179e491e696c9d2eb5a6d4..f5239ede6e8f0b478a81625261a805165e13403c
@@@ -210,13 -210,6 +210,13 @@@ ssl_init (
       than examining the error stack after a failed SSL_connect.  */
    SSL_CTX_set_verify (ssl_ctx, SSL_VERIFY_NONE, NULL);
  
 +  /* Use the private key from the cert file unless otherwise specified. */
 +  if (opt.cert_file && !opt.private_key)
 +    {
 +      opt.private_key = opt.cert_file;
 +      opt.private_key_type = opt.cert_type;
 +    }
 +
    if (opt.cert_file)
      if (SSL_CTX_use_certificate_file (ssl_ctx, opt.cert_file,
                                        key_type_to_ssl_type (opt.cert_type))
@@@ -502,7 -495,7 +502,7 @@@ ssl_check_certificate (int fd, const ch
    if (!cert)
      {
        logprintf (LOG_NOTQUIET, _("%s: No certificate presented by %s.\n"),
-                  severity, escnonprint (host));
+                  severity, quotearg_style (escape_quoting_style, host));
        success = false;
        goto no_cert;             /* must bail out since CERT is NULL */
      }
        char *subject = X509_NAME_oneline (X509_get_subject_name (cert), 0, 0);
        char *issuer = X509_NAME_oneline (X509_get_issuer_name (cert), 0, 0);
        DEBUGP (("certificate:\n  subject: %s\n  issuer:  %s\n",
-                escnonprint (subject), escnonprint (issuer)));
+                quotearg_style (escape_quoting_style, subject), 
+                quotearg_style (escape_quoting_style, issuer)));
        OPENSSL_free (subject);
        OPENSSL_free (issuer);
      }
      {
        char *issuer = X509_NAME_oneline (X509_get_issuer_name (cert), 0, 0);
        logprintf (LOG_NOTQUIET,
-                  _("%s: cannot verify %s's certificate, issued by `%s':\n"),
-                  severity, escnonprint (host), escnonprint (issuer));
+                  _("%s: cannot verify %s's certificate, issued by %s:\n"),
+                  severity, quotearg_style (escape_quoting_style, host), 
+                  quote (issuer));
        /* Try to print more user-friendly (and translated) messages for
           the frequent verification errors.  */
        switch (vresult)
    if (!pattern_match (common_name, host))
      {
        logprintf (LOG_NOTQUIET, _("\
- %s: certificate common name `%s' doesn't match requested host name `%s'.\n"),
-                  severity, escnonprint (common_name), escnonprint (host));
+ %s: certificate common name %s doesn't match requested host name %s.\n"),
+                  severity, quote (common_name), quote (host));
        success = false;
      }
  
    if (success)
      DEBUGP (("X509 certificate successfully verified and matches host %s\n",
-              escnonprint (host)));
+              quotearg_style (escape_quoting_style, host)));
    X509_free (cert);
  
   no_cert:
    if (opt.check_cert && !success)
      logprintf (LOG_NOTQUIET, _("\
  To connect to %s insecurely, use `--no-check-certificate'.\n"),
-                escnonprint (host));
+                quotearg_style (escape_quoting_style, host));
  
    /* Allow --no-check-cert to disable certificate checking. */
    return opt.check_cert ? success : true;
diff --combined src/progress.c
index 9e0099930a88b2e4c3b5683e5d1d8dab184d0726,8b9b1013a255668de285219819bbefc088a118e7..de108e76be44bb72e29bcdeef9a2a8e800472f54
@@@ -453,8 -453,8 +453,8 @@@ dot_set_params (const char *params
      }
    else
      fprintf (stderr,
-              _("Invalid dot style specification `%s'; leaving unchanged.\n"),
-              params);
+              _("Invalid dot style specification %s; leaving unchanged.\n"),
+              quote (params));
  }
  \f
  /* "Thermometer" (bar) progress. */
@@@ -797,14 -797,15 +797,14 @@@ count_cols (const char *mbs
  # define count_cols(mbs) ((int)(strlen(mbs)))
  #endif
  
 -/* Translation note: "ETA" is English-centric, but this must
 -   be short, ideally 3 chars.  Abbreviate if necessary.  */
 -static const char eta_str[] = N_("  eta %s");
 -static const char *eta_trans;
 -static int bytes_cols_diff;
 -
  const char *
 -get_eta (void)
 +get_eta (int *bcd)
  {
 +  /* Translation note: "ETA" is English-centric, but this must
 +     be short, ideally 3 chars.  Abbreviate if necessary.  */
 +  static const char eta_str[] = N_("  eta %s");
 +  static const char *eta_trans;
 +  static int bytes_cols_diff;
    if (eta_trans == NULL)
      {
        int nbytes;
        bytes_cols_diff = nbytes - ncols;
      }
  
 +  if (bcd != NULL)
 +    *bcd = bytes_cols_diff;
 +
    return eta_trans;
  }
  
@@@ -883,10 -881,6 +883,10 @@@ create_image (struct bar_progress *bp, 
    int dlbytes_size = 1 + MAX (size_grouped_len, 11);
    int progress_size = bp->width - (4 + 2 + dlbytes_size + 8 + 14);
  
 +  /* The difference between the number of bytes used,
 +     and the number of columns used. */
 +  int bytes_cols_diff = 0;
 +
    if (progress_size < 5)
      progress_size = 0;
  
                bp->last_eta_time = dl_total_time;
              }
  
 -          sprintf (p, get_eta(), eta_to_human_short (eta, false));
 +          sprintf (p, get_eta(&bytes_cols_diff),
 +                   eta_to_human_short (eta, false));
            move_to_end (p);
          }
        else if (bp->total_length > 0)
    else
      {
        /* When the download is done, print the elapsed time.  */
 +      int nbytes;
 +      int ncols;
  
        /* Note to translators: this should not take up more room than
           available here.  Abbreviate if necessary.  */
        strcpy (p, _("   in "));
 -      move_to_end (p);          /* not p+=6, think translations! */
 +      nbytes = strlen (p);
 +      ncols  = count_cols (p);
 +      bytes_cols_diff = nbytes - ncols;
 +      p += nbytes;
        if (dl_total_time >= 10)
          strcpy (p, eta_to_human_short ((int) (dl_total_time + 0.5), false));
        else
diff --combined src/utils.c
index 85a83355a6ace521faf8b84a283a20f3ae2c0fe7,c4f78fe4b766c05b8b1def56b22650ff8bfb0737..a6c84491605517a8f0af7637ff681c70e943340f
@@@ -88,6 -88,32 +88,32 @@@ as that of the covered work.  *
  #include "test.h"
  #endif 
  
+ static void
+ memfatal (const char *context, long attempted_size)
+ {
+   /* Make sure we don't try to store part of the log line, and thus
+      call malloc.  */
+   log_set_save_context (false);
+   /* We have different log outputs in different situations:
+      1) output without bytes information
+      2) output with bytes information  */
+   if (attempted_size == UNKNOWN_ATTEMPTED_SIZE)
+     {
+       logprintf (LOG_ALWAYS,
+                  _("%s: %s: Failed to allocate enough memory; memory exhausted.\n"),
+                  exec_name, context);
+     }
+   else
+     {
+       logprintf (LOG_ALWAYS,
+                  _("%s: %s: Failed to allocate %ld bytes; memory exhausted.\n"),
+                  exec_name, context, attempted_size);
+     }
+   exit (1);
+ }
  /* Utility function: like xstrdup(), but also lowercases S.  */
  
  char *
@@@ -348,7 -374,7 +374,7 @@@ fork_to_background (void
        /* parent, no error */
        printf (_("Continuing in background, pid %d.\n"), (int) pid);
        if (logfile_changed)
-         printf (_("Output will be written to `%s'.\n"), opt.lfilename);
+         printf (_("Output will be written to %s.\n"), quote (opt.lfilename));
        exit (0);                 /* #### should we use _exit()? */
      }
  
@@@ -394,8 -420,8 +420,8 @@@ remove_link (const char *file
        DEBUGP (("Unlinking %s (symlink).\n", file));
        err = unlink (file);
        if (err != 0)
-         logprintf (LOG_VERBOSE, _("Failed to unlink symlink `%s': %s\n"),
-                    file, strerror (errno));
+         logprintf (LOG_VERBOSE, _("Failed to unlink symlink %s: %s\n"),
+                    quote (file), strerror (errno));
      }
    return err;
  }
@@@ -2205,8 -2231,6 +2231,8 @@@ test_dir_matches_p(
      { { "*/*COMPLETE", NULL, NULL }, "foo/!COMPLETE", true },
      { { "/dir with spaces", NULL, NULL }, "dir with spaces", true },
      { { "/dir*with*spaces", NULL, NULL }, "dir with spaces", true },
 +    { { "/Tmp/has", NULL, NULL }, "/Tmp/has space", false },
 +    { { "/Tmp/has", NULL, NULL }, "/Tmp/has,comma", false },
    };
    
    for (i = 0; i < countof(test_array); ++i)