/* Various utility functions.
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+ 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This file is part of GNU Wget.
You should have received a copy of the GNU General Public License
along with Wget. If not, see <http://www.gnu.org/licenses/>.
-In addition, as a special exception, the Free Software Foundation
-gives permission to link the code of its release of Wget with the
-OpenSSL project's "OpenSSL" library (or with modified versions of it
-that use the same license as the "OpenSSL" library), and distribute
-the linked executables. You must obey the GNU General Public License
-in all respects for all of the code used other than "OpenSSL". If you
-modify this file, you may extend this exception to your version of the
-file, but you are not obligated to do so. If you do not wish to do
-so, delete this exception statement from your version. */
+Additional permission under GNU GPL version 3 section 7
-#include <config.h>
+If you modify this program, or any covered work, by linking or
+combining it with the OpenSSL project's OpenSSL library (or a
+modified version of that library), containing parts covered by the
+terms of the OpenSSL or SSLeay licenses, the Free Software Foundation
+grants you additional permission to convey the resulting work.
+Corresponding Source for a non-source form of such a combination
+shall include the source code for the parts of OpenSSL used as well
+as that of the covered work. */
+
+#include "wget.h"
#include <stdio.h>
#include <stdlib.h>
# define USE_SIGNAL_TIMEOUT
#endif
-#include "wget.h"
#include "utils.h"
#include "hash.h"
ret = vasprintf (&str, fmt, args);
va_end (args);
if (ret < 0 && errno == ENOMEM)
- abort (); /* for consistency with xmalloc/xrealloc */
+ memfatal ("aprintf", UNKNOWN_ATTEMPTED_SIZE); /* for consistency with xmalloc/xrealloc */
else if (ret < 0)
return NULL;
return str;
/* Whether we arrange our own version of opt.lfilename here. */
bool logfile_changed = false;
- if (!opt.lfilename)
+ if (!opt.lfilename && (!opt.quiet || opt.server_response))
{
/* We must create the file immediately to avoid either a race
condition (which arises from using unique_name and failing to
bool
subdir_p (const char *d1, const char *d2)
{
+ if (*d1 == '\0')
+ return true;
if (!opt.ignore_case)
for (; *d1 && *d2 && (*d1 == *d2); ++d1, ++d2)
;
struct lconv *lconv = localeconv ();
cached_sep = lconv->thousands_sep;
cached_grouping = lconv->grouping;
+#if ! USE_NLS_PROGRESS_BAR
+ /* We can't count column widths, so ensure that the separator
+ * is single-byte only (let check below determine what byte). */
+ if (strlen(cached_sep) > 1)
+ cached_sep = "";
+#endif
if (!*cached_sep)
{
/* Many locales (such as "C" or "hr_HR") don't specify
{ { "/somedir", "/someotherdir", NULL }, "anotherdir", false },
{ { "/somedir", "/*otherdir", NULL }, "anotherdir", true },
{ { "/somedir/d1", "/someotherdir", NULL }, "somedir/d1", true },
+ { { "*/*d1", "/someotherdir", NULL }, "somedir/d1", true },
{ { "/somedir/d1", "/someotherdir", NULL }, "d1", false },
+ { { "!COMPLETE", NULL, NULL }, "!COMPLETE", true },
+ { { "*COMPLETE", NULL, NULL }, "!COMPLETE", true },
+ { { "*/!COMPLETE", NULL, NULL }, "foo/!COMPLETE", true },
+ { { "*COMPLETE", NULL, NULL }, "foo/!COMPLETE", false },
+ { { "*/*COMPLETE", NULL, NULL }, "foo/!COMPLETE", true },
+ { { "/dir with spaces", NULL, NULL }, "dir with spaces", true },
+ { { "/dir*with*spaces", NULL, NULL }, "dir with spaces", true },
};
for (i = 0; i < countof(test_array); ++i)