#endif
#include <string.h>
#include <errno.h>
+#include <limits.h>
+/* not all systems provide PATH_MAX in limits.h */
+#ifndef PATH_MAX
+# include <sys/param.h>
+# ifndef PATH_MAX
+# define PATH_MAX MAXPATHLEN
+# endif
+#endif
+
#ifdef HAVE_PWD_H
# include <pwd.h>
/* KEEP THIS LIST ALPHABETICALLY SORTED */
{ "accept", &opt.accepts, cmd_vector },
{ "addhostdir", &opt.add_hostdir, cmd_boolean },
+ { "adjustextension", &opt.adjust_extension, cmd_boolean },
{ "alwaysrest", &opt.always_rest, cmd_boolean }, /* deprecated */
{ "askpassword", &opt.ask_passwd, cmd_boolean },
{ "authnochallenge", &opt.auth_without_challenge,
{ "ftpuser", &opt.ftp_user, cmd_string },
{ "glob", &opt.ftp_glob, cmd_boolean },
{ "header", NULL, cmd_spec_header },
- { "htmlextension", &opt.html_extension, cmd_boolean },
+ { "htmlextension", &opt.adjust_extension, cmd_boolean }, /* deprecated */
{ "htmlify", NULL, cmd_spec_htmlify },
{ "httpkeepalive", &opt.http_keep_alive, cmd_boolean },
{ "httppasswd", &opt.http_passwd, cmd_string }, /* deprecated */
{ "postdata", &opt.post_data, cmd_string },
{ "postfile", &opt.post_file_name, cmd_file },
{ "preferfamily", NULL, cmd_spec_prefer_family },
- { "preservepermissions", &opt.preserve_perm, cmd_boolean },
+ { "preservepermissions", &opt.preserve_perm, cmd_boolean },/* deprecated */
#ifdef HAVE_SSL
{ "privatekey", &opt.private_key, cmd_file },
{ "privatekeytype", &opt.private_key_type, cmd_cert_type },
{ "useproxy", &opt.use_proxy, cmd_boolean },
{ "user", &opt.user, cmd_string },
{ "useragent", NULL, cmd_spec_useragent },
+ { "useservertimestamps", &opt.useservertimestamps, cmd_boolean },
{ "verbose", NULL, cmd_spec_verbose },
{ "wait", &opt.wait, cmd_time },
{ "waitretry", &opt.waitretry, cmd_time },
-#ifdef MSDOS
+#ifdef USE_WATT32
{ "wdebug", &opt.wdebug, cmd_boolean },
#endif
};
opt.restrict_files_os = restrict_unix;
#endif
opt.restrict_files_ctrl = true;
+ opt.restrict_files_nonascii = false;
opt.restrict_files_case = restrict_no_case_restriction;
opt.max_redirect = 20;
#endif
opt.locale = NULL;
opt.encoding_remote = NULL;
+
+ opt.useservertimestamps = true;
}
\f
/* Return the user's home directory (strdup-ed), or NULL if none is
return home ? xstrdup (home) : NULL;
}
-/* Check the 'WGETRC' environment variable and return the file name
- if 'WGETRC' is set and is a valid file.
+/* Check the 'WGETRC' environment variable and return the file name
+ if 'WGETRC' is set and is a valid file.
If the `WGETRC' variable exists but the file does not exist, the
function will exit(). */
char *
-wgetrc_env_file_name (void)
+wgetrc_env_file_name (void)
{
char *env = getenv ("WGETRC");
if (env && *env)
/* Check for the existance of '$HOME/.wgetrc' and return it's path
if it exists and is set. */
char *
-wgetrc_user_file_name (void)
+wgetrc_user_file_name (void)
{
char *home = home_dir ();
char *file = NULL;
/* Return the path to the user's .wgetrc. This is either the value of
`WGETRC' environment variable, or `$HOME/.wgetrc'.
- Additionally, for windows, look in the directory where wget.exe
+ Additionally, for windows, look in the directory where wget.exe
resides. */
char *
wgetrc_file_name (void)
char *file = wgetrc_env_file_name ();
if (file && *file)
return file;
-
+
file = wgetrc_user_file_name ();
#ifdef WINDOWS
/* Load the hard-coded defaults. */
defaults ();
-
- /* Run a non-standard system rc file when the according environment
+
+ /* Run a non-standard system rc file when the according environment
variable has been set. For internal testing purposes only! */
env_sysrc = getenv ("SYSTEM_WGETRC");
if (env_sysrc && file_exists_p (env_sysrc))
int restrict_os = opt.restrict_files_os;
int restrict_ctrl = opt.restrict_files_ctrl;
int restrict_case = opt.restrict_files_case;
+ int restrict_nonascii = opt.restrict_files_nonascii;
const char *end;
end = strchr (val, ',');
if (!end)
end = val + strlen (val);
-
+
if (VAL_IS ("unix"))
restrict_os = restrict_unix;
else if (VAL_IS ("windows"))
restrict_case = restrict_uppercase;
else if (VAL_IS ("nocontrol"))
restrict_ctrl = false;
+ else if (VAL_IS ("ascii"))
+ restrict_nonascii = true;
else
{
- fprintf (stderr,
- _("%s: %s: Invalid restriction %s, use [unix|windows],[lowercase|uppercase],[nocontrol].\n"),
+ fprintf (stderr, _("\
+%s: %s: Invalid restriction %s,\n\
+ use [unix|windows],[lowercase|uppercase],[nocontrol],[ascii].\n"),
exec_name, com, quote (val));
return false;
}
- if (*end)
+ if (*end)
val = end + 1;
}
while (*val && *end);
opt.restrict_files_os = restrict_os;
opt.restrict_files_ctrl = restrict_ctrl;
opt.restrict_files_case = restrict_case;
-
+ opt.restrict_files_nonascii = restrict_nonascii;
+
return true;
}
xfree_null (opt.user);
xfree_null (opt.passwd);
xfree_null (opt.base_href);
-
+
#endif /* DEBUG_MALLOC */
}
\f
{
mu_assert ("FAILED", false);
break;
- }
+ }
else
- {
+ {
prev_idx ++;
next_idx ++;
}
{ "windows,lowercase", restrict_windows, true, restrict_lowercase, true },
{ "unix,nocontrol,lowercase,", restrict_unix, false, restrict_lowercase, true },
};
-
- for (i = 0; i < sizeof(test_array)/sizeof(test_array[0]); ++i)
+
+ for (i = 0; i < sizeof(test_array)/sizeof(test_array[0]); ++i)
{
bool res;
-
+
defaults();
res = cmd_spec_restrict_file_names ("dummy", test_array[i].val, NULL);
fprintf (stderr, "opt.restrict_files_ctrl: %d\n", opt.restrict_files_ctrl); fflush (stderr);
fprintf (stderr, "opt.restrict_files_case: %d\n", opt.restrict_files_case); fflush (stderr);
*/
- mu_assert ("test_cmd_spec_restrict_file_names: wrong result",
+ mu_assert ("test_cmd_spec_restrict_file_names: wrong result",
res == test_array[i].result
- && opt.restrict_files_os == test_array[i].expected_restrict_files_os
- && opt.restrict_files_ctrl == test_array[i].expected_restrict_files_ctrl
+ && opt.restrict_files_os == test_array[i].expected_restrict_files_os
+ && opt.restrict_files_ctrl == test_array[i].expected_restrict_files_ctrl
&& opt.restrict_files_case == test_array[i].expected_restrict_files_case);
}