mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
[svn] Default dir_prefix to NULL rather than ".".
This commit is contained in:
parent
4fd9c65005
commit
a504d10ed5
@ -1,3 +1,11 @@
|
|||||||
|
2003-09-19 Hrvoje Niksic <hniksic@xemacs.org>
|
||||||
|
|
||||||
|
* url.c (url_file_name): Expect NULL dir_prefix.
|
||||||
|
|
||||||
|
* init.c (cmd_file): Use a macro to prevent multiple #ifdef
|
||||||
|
WINDOWS.
|
||||||
|
(defaults): Set dir_prefix to NULL by default.
|
||||||
|
|
||||||
2003-09-19 Hrvoje Niksic <hniksic@xemacs.org>
|
2003-09-19 Hrvoje Niksic <hniksic@xemacs.org>
|
||||||
|
|
||||||
* safe-ctype.h (_sch_test): Cast BIT to unsigned char, like latest
|
* safe-ctype.h (_sch_test): Cast BIT to unsigned char, like latest
|
||||||
|
29
src/init.c
29
src/init.c
@ -256,7 +256,6 @@ defaults (void)
|
|||||||
opt.cookies = 1;
|
opt.cookies = 1;
|
||||||
|
|
||||||
opt.verbose = -1;
|
opt.verbose = -1;
|
||||||
opt.dir_prefix = xstrdup (".");
|
|
||||||
opt.ntry = 20;
|
opt.ntry = 20;
|
||||||
opt.reclevel = 5;
|
opt.reclevel = 5;
|
||||||
opt.add_hostdir = 1;
|
opt.add_hostdir = 1;
|
||||||
@ -668,6 +667,12 @@ cmd_string (const char *com, const char *val, void *closure)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef WINDOWS
|
||||||
|
# define ISSEP(c) ((c) == '/')
|
||||||
|
#else
|
||||||
|
# define ISSEP(c) ((c) == '/' || (c) == '\\')
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Like the above, but handles tilde-expansion when reading a user's
|
/* Like the above, but handles tilde-expansion when reading a user's
|
||||||
`.wgetrc'. In that case, and if VAL begins with `~', the tilde
|
`.wgetrc'. In that case, and if VAL begins with `~', the tilde
|
||||||
gets expanded to the user's home directory. */
|
gets expanded to the user's home directory. */
|
||||||
@ -680,11 +685,7 @@ cmd_file (const char *com, const char *val, void *closure)
|
|||||||
|
|
||||||
/* #### If VAL is empty, perhaps should set *CLOSURE to NULL. */
|
/* #### If VAL is empty, perhaps should set *CLOSURE to NULL. */
|
||||||
|
|
||||||
if (!enable_tilde_expansion || !(*val == '~' && (*(val + 1) == '/'
|
if (!enable_tilde_expansion || !(*val == '~' && ISSEP (val[1])))
|
||||||
#ifdef WINDOWS
|
|
||||||
|| *(val + 1) == '\\'
|
|
||||||
#endif
|
|
||||||
)))
|
|
||||||
{
|
{
|
||||||
noexpand:
|
noexpand:
|
||||||
*pstring = xstrdup (val);
|
*pstring = xstrdup (val);
|
||||||
@ -698,21 +699,12 @@ cmd_file (const char *com, const char *val, void *closure)
|
|||||||
goto noexpand;
|
goto noexpand;
|
||||||
|
|
||||||
homelen = strlen (home);
|
homelen = strlen (home);
|
||||||
while (homelen && (home[homelen - 1] == '/'
|
while (homelen && ISSEP (home[homelen - 1]))
|
||||||
#ifdef WINDOWS
|
|
||||||
|| home[homelen - 1] == '\\'
|
|
||||||
#endif
|
|
||||||
))
|
|
||||||
home[--homelen] = '\0';
|
home[--homelen] = '\0';
|
||||||
|
|
||||||
/* Skip the leading "~/". */
|
/* Skip the leading "~/". */
|
||||||
#ifdef WINDOWS
|
for (++val; ISSEP (*val); val++)
|
||||||
for (++val; *val == '/' || *val == '\\'; val++)
|
|
||||||
;
|
;
|
||||||
#else
|
|
||||||
for (++val; *val == '/'; val++)
|
|
||||||
;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
result = xmalloc (homelen + 1 + strlen (val) + 1);
|
result = xmalloc (homelen + 1 + strlen (val) + 1);
|
||||||
memcpy (result, home, homelen);
|
memcpy (result, home, homelen);
|
||||||
@ -721,6 +713,7 @@ cmd_file (const char *com, const char *val, void *closure)
|
|||||||
|
|
||||||
*pstring = result;
|
*pstring = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
/* Convert "\" to "/". */
|
/* Convert "\" to "/". */
|
||||||
{
|
{
|
||||||
@ -1146,7 +1139,7 @@ cleanup (void)
|
|||||||
free_netrc (netrc_list);
|
free_netrc (netrc_list);
|
||||||
}
|
}
|
||||||
FREE_MAYBE (opt.lfilename);
|
FREE_MAYBE (opt.lfilename);
|
||||||
xfree (opt.dir_prefix);
|
FREE_MAYBE (opt.dir_prefix);
|
||||||
FREE_MAYBE (opt.input_filename);
|
FREE_MAYBE (opt.input_filename);
|
||||||
FREE_MAYBE (opt.output_document);
|
FREE_MAYBE (opt.output_document);
|
||||||
free_vec (opt.accepts);
|
free_vec (opt.accepts);
|
||||||
|
16
src/url.c
16
src/url.c
@ -54,16 +54,6 @@ so, delete this exception statement from your version. */
|
|||||||
extern int errno;
|
extern int errno;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Is X "."? */
|
|
||||||
#define DOTP(x) ((*(x) == '.') && (!*(x + 1)))
|
|
||||||
/* Is X ".."? */
|
|
||||||
#define DDOTP(x) ((*(x) == '.') && (*(x + 1) == '.') && (!*(x + 2)))
|
|
||||||
|
|
||||||
static const int NS_INADDRSZ = 4;
|
|
||||||
static const int NS_IN6ADDRSZ = 16;
|
|
||||||
static const int NS_INT16SZ = 2;
|
|
||||||
|
|
||||||
|
|
||||||
struct scheme_data
|
struct scheme_data
|
||||||
{
|
{
|
||||||
char *leading_string;
|
char *leading_string;
|
||||||
@ -711,6 +701,10 @@ is_valid_ipv4_address (const char *str, const char *end)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const int NS_INADDRSZ = 4;
|
||||||
|
static const int NS_IN6ADDRSZ = 16;
|
||||||
|
static const int NS_INT16SZ = 2;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
is_valid_ipv6_address (const char *str, const char *end)
|
is_valid_ipv6_address (const char *str, const char *end)
|
||||||
{
|
{
|
||||||
@ -1663,7 +1657,7 @@ url_file_name (const struct url *u)
|
|||||||
fnres.tail = 0;
|
fnres.tail = 0;
|
||||||
|
|
||||||
/* Start with the directory prefix, if specified. */
|
/* Start with the directory prefix, if specified. */
|
||||||
if (!DOTP (opt.dir_prefix))
|
if (opt.dir_prefix)
|
||||||
append_string (opt.dir_prefix, &fnres);
|
append_string (opt.dir_prefix, &fnres);
|
||||||
|
|
||||||
/* If "dirstruct" is turned on (typically the case with -r), add
|
/* If "dirstruct" is turned on (typically the case with -r), add
|
||||||
|
Loading…
Reference in New Issue
Block a user