mirror of
https://github.com/mirror/wget.git
synced 2025-01-23 18:50:11 +08:00
Add options for enabling IRI support and forcing some encodings
This commit is contained in:
parent
d66a45f828
commit
d9cd5d2207
@ -181,9 +181,15 @@ static const struct {
|
|||||||
{ "inet6only", &opt.ipv6_only, cmd_boolean },
|
{ "inet6only", &opt.ipv6_only, cmd_boolean },
|
||||||
#endif
|
#endif
|
||||||
{ "input", &opt.input_filename, cmd_file },
|
{ "input", &opt.input_filename, cmd_file },
|
||||||
|
#ifdef ENABLE_IRI
|
||||||
|
{ "iri", &opt.enable_iri, cmd_boolean },
|
||||||
|
#endif
|
||||||
{ "keepsessioncookies", &opt.keep_session_cookies, cmd_boolean },
|
{ "keepsessioncookies", &opt.keep_session_cookies, cmd_boolean },
|
||||||
{ "limitrate", &opt.limit_rate, cmd_bytes },
|
{ "limitrate", &opt.limit_rate, cmd_bytes },
|
||||||
{ "loadcookies", &opt.cookies_input, cmd_file },
|
{ "loadcookies", &opt.cookies_input, cmd_file },
|
||||||
|
#ifdef ENABLE_IRI
|
||||||
|
{ "locale", &opt.locale, cmd_string },
|
||||||
|
#endif
|
||||||
{ "logfile", &opt.lfilename, cmd_file },
|
{ "logfile", &opt.lfilename, cmd_file },
|
||||||
{ "login", &opt.ftp_user, cmd_string },/* deprecated*/
|
{ "login", &opt.ftp_user, cmd_string },/* deprecated*/
|
||||||
{ "maxredirect", &opt.max_redirect, cmd_number },
|
{ "maxredirect", &opt.max_redirect, cmd_number },
|
||||||
@ -223,6 +229,9 @@ static const struct {
|
|||||||
{ "referer", &opt.referer, cmd_string },
|
{ "referer", &opt.referer, cmd_string },
|
||||||
{ "reject", &opt.rejects, cmd_vector },
|
{ "reject", &opt.rejects, cmd_vector },
|
||||||
{ "relativeonly", &opt.relative_only, cmd_boolean },
|
{ "relativeonly", &opt.relative_only, cmd_boolean },
|
||||||
|
#ifdef ENABLE_IRI
|
||||||
|
{ "remoteencoding", &opt.encoding_remote, cmd_string },
|
||||||
|
#endif
|
||||||
{ "removelisting", &opt.remove_listing, cmd_boolean },
|
{ "removelisting", &opt.remove_listing, cmd_boolean },
|
||||||
{ "restrictfilenames", NULL, cmd_spec_restrict_file_names },
|
{ "restrictfilenames", NULL, cmd_spec_restrict_file_names },
|
||||||
{ "retrsymlinks", &opt.retr_symlinks, cmd_boolean },
|
{ "retrsymlinks", &opt.retr_symlinks, cmd_boolean },
|
||||||
|
30
src/main.c
30
src/main.c
@ -43,6 +43,9 @@ as that of the covered work. */
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#ifdef ENABLE_IRI
|
||||||
|
#include <langinfo.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "init.h"
|
#include "init.h"
|
||||||
@ -190,10 +193,16 @@ static struct cmdline_option option_data[] =
|
|||||||
{ "inet6-only", '6', OPT_BOOLEAN, "inet6only", -1 },
|
{ "inet6-only", '6', OPT_BOOLEAN, "inet6only", -1 },
|
||||||
#endif
|
#endif
|
||||||
{ "input-file", 'i', OPT_VALUE, "input", -1 },
|
{ "input-file", 'i', OPT_VALUE, "input", -1 },
|
||||||
|
#ifdef ENABLE_IRI
|
||||||
|
{ "iri", 0, OPT_BOOLEAN, "iri", -1 },
|
||||||
|
#endif
|
||||||
{ "keep-session-cookies", 0, OPT_BOOLEAN, "keepsessioncookies", -1 },
|
{ "keep-session-cookies", 0, OPT_BOOLEAN, "keepsessioncookies", -1 },
|
||||||
{ "level", 'l', OPT_VALUE, "reclevel", -1 },
|
{ "level", 'l', OPT_VALUE, "reclevel", -1 },
|
||||||
{ "limit-rate", 0, OPT_VALUE, "limitrate", -1 },
|
{ "limit-rate", 0, OPT_VALUE, "limitrate", -1 },
|
||||||
{ "load-cookies", 0, OPT_VALUE, "loadcookies", -1 },
|
{ "load-cookies", 0, OPT_VALUE, "loadcookies", -1 },
|
||||||
|
#ifdef ENABLE_IRI
|
||||||
|
{ "locale", 0, OPT_VALUE, "locale", -1 },
|
||||||
|
#endif
|
||||||
{ "max-redirect", 0, OPT_VALUE, "maxredirect", -1 },
|
{ "max-redirect", 0, OPT_VALUE, "maxredirect", -1 },
|
||||||
{ "mirror", 'm', OPT_BOOLEAN, "mirror", -1 },
|
{ "mirror", 'm', OPT_BOOLEAN, "mirror", -1 },
|
||||||
{ "no", 'n', OPT__NO, NULL, required_argument },
|
{ "no", 'n', OPT__NO, NULL, required_argument },
|
||||||
@ -227,6 +236,9 @@ static struct cmdline_option option_data[] =
|
|||||||
{ "referer", 0, OPT_VALUE, "referer", -1 },
|
{ "referer", 0, OPT_VALUE, "referer", -1 },
|
||||||
{ "reject", 'R', OPT_VALUE, "reject", -1 },
|
{ "reject", 'R', OPT_VALUE, "reject", -1 },
|
||||||
{ "relative", 'L', OPT_BOOLEAN, "relativeonly", -1 },
|
{ "relative", 'L', OPT_BOOLEAN, "relativeonly", -1 },
|
||||||
|
#ifdef ENABLE_IRI
|
||||||
|
{ "remote-encoding", 0, OPT_VALUE, "remoteencoding", -1},
|
||||||
|
#endif
|
||||||
{ "remove-listing", 0, OPT_BOOLEAN, "removelisting", -1 },
|
{ "remove-listing", 0, OPT_BOOLEAN, "removelisting", -1 },
|
||||||
{ "restrict-file-names", 0, OPT_BOOLEAN, "restrictfilenames", -1 },
|
{ "restrict-file-names", 0, OPT_BOOLEAN, "restrictfilenames", -1 },
|
||||||
{ "retr-symlinks", 0, OPT_BOOLEAN, "retrsymlinks", -1 },
|
{ "retr-symlinks", 0, OPT_BOOLEAN, "retrsymlinks", -1 },
|
||||||
@ -947,6 +959,24 @@ for details.\n\n"));
|
|||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_IRI
|
||||||
|
if (opt.enable_iri)
|
||||||
|
{
|
||||||
|
if (!opt.locale)
|
||||||
|
{
|
||||||
|
opt.locale = getenv ("CHARSET");
|
||||||
|
|
||||||
|
if (opt.locale == NULL)
|
||||||
|
opt.locale = nl_langinfo(CODESET);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* sXXXav : check given locale */
|
||||||
|
logprintf (LOG_VERBOSE, "Check the locale...\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (opt.ask_passwd)
|
if (opt.ask_passwd)
|
||||||
{
|
{
|
||||||
opt.passwd = prompt_for_password ();
|
opt.passwd = prompt_for_password ();
|
||||||
|
@ -237,6 +237,12 @@ struct options
|
|||||||
bool content_disposition; /* Honor HTTP Content-Disposition header. */
|
bool content_disposition; /* Honor HTTP Content-Disposition header. */
|
||||||
bool auth_without_challenge; /* Issue Basic authentication creds without
|
bool auth_without_challenge; /* Issue Basic authentication creds without
|
||||||
waiting for a challenge. */
|
waiting for a challenge. */
|
||||||
|
|
||||||
|
#ifdef ENABLE_IRI
|
||||||
|
bool enable_iri;
|
||||||
|
char *encoding_remote;
|
||||||
|
char *locale;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct options opt;
|
extern struct options opt;
|
||||||
|
Loading…
Reference in New Issue
Block a user