+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>
* safe-ctype.h (_sch_test): Cast BIT to unsigned char, like latest
opt.cookies = 1;
opt.verbose = -1;
- opt.dir_prefix = xstrdup (".");
opt.ntry = 20;
opt.reclevel = 5;
opt.add_hostdir = 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
`.wgetrc'. In that case, and if VAL begins with `~', the tilde
gets expanded to the user's home directory. */
/* #### If VAL is empty, perhaps should set *CLOSURE to NULL. */
- if (!enable_tilde_expansion || !(*val == '~' && (*(val + 1) == '/'
-#ifdef WINDOWS
- || *(val + 1) == '\\'
-#endif
- )))
+ if (!enable_tilde_expansion || !(*val == '~' && ISSEP (val[1])))
{
noexpand:
*pstring = xstrdup (val);
goto noexpand;
homelen = strlen (home);
- while (homelen && (home[homelen - 1] == '/'
-#ifdef WINDOWS
- || home[homelen - 1] == '\\'
-#endif
- ))
+ while (homelen && ISSEP (home[homelen - 1]))
home[--homelen] = '\0';
/* Skip the leading "~/". */
-#ifdef WINDOWS
- for (++val; *val == '/' || *val == '\\'; val++)
- ;
-#else
- for (++val; *val == '/'; val++)
+ for (++val; ISSEP (*val); val++)
;
-#endif
result = xmalloc (homelen + 1 + strlen (val) + 1);
memcpy (result, home, homelen);
*pstring = result;
}
+
#ifdef WINDOWS
/* Convert "\" to "/". */
{
free_netrc (netrc_list);
}
FREE_MAYBE (opt.lfilename);
- xfree (opt.dir_prefix);
+ FREE_MAYBE (opt.dir_prefix);
FREE_MAYBE (opt.input_filename);
FREE_MAYBE (opt.output_document);
free_vec (opt.accepts);
extern int errno;
#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
{
char *leading_string;
return 1;
}
+static const int NS_INADDRSZ = 4;
+static const int NS_IN6ADDRSZ = 16;
+static const int NS_INT16SZ = 2;
+
static int
is_valid_ipv6_address (const char *str, const char *end)
{
fnres.tail = 0;
/* Start with the directory prefix, if specified. */
- if (!DOTP (opt.dir_prefix))
+ if (opt.dir_prefix)
append_string (opt.dir_prefix, &fnres);
/* If "dirstruct" is turned on (typically the case with -r), add