]> sjero.net Git - wget/commitdiff
Automaetd merge.
authorSaint Xavier <wget@sxav.eu>
Sun, 8 Jun 2008 11:00:15 +0000 (13:00 +0200)
committerSaint Xavier <wget@sxav.eu>
Sun, 8 Jun 2008 11:00:15 +0000 (13:00 +0200)
1  2 
src/http.c
src/init.c
src/main.c

diff --combined src/http.c
index 682258c073c3d6bf5472f99c7962b7ac5f5e1f96,919d7593b16d0005f1d4a20783e241daf386cab5..543165fdd0a7b75f05859b7ad021ccec8b539144
@@@ -2040,32 -2040,9 +2040,32 @@@ File %s already there; not retrieving.\
        char *tmp = strchr (type, ';');
        if (tmp)
          {
 +#ifdef ENABLE_IRI
 +          char *tmp2 = tmp + 1;
 +#endif
 +
            while (tmp > type && c_isspace (tmp[-1]))
              --tmp;
            *tmp = '\0';
 +
 +#ifdef ENABLE_IRI
 +          if (opt.enable_iri && *tmp2 != '\0' &&
 +              (tmp = strstr (tmp2, "charset=")) != NULL)
 +            {
 +              tmp += 8;
 +              tmp2 = tmp;
 +
 +              while (*tmp2 && !c_isspace (*tmp2))
 +                tmp2++;
 +
 +              if (tmp2 > tmp)
 +                {
 +                  *tmp2 = '\0';
 +                  /* sXXXav : check given charset */
 +                  logprintf (LOG_VERBOSE, "HTTP charset: `%s'\n", tmp);
 +                }
 +            }
 +#endif
          }
      }
    hs->newloc = resp_header_strdup (resp, "Location");
@@@ -2931,7 -2908,7 +2931,7 @@@ http_atotm (const char *time_string
                                     Netscape cookie specification.) */
    };
    const char *oldlocale;
-   int i;
+   size_t i;
    time_t ret = (time_t) -1;
  
    /* Solaris strptime fails to recognize English month names in
@@@ -3042,10 -3019,12 +3042,12 @@@ digest_authentication_encode (const cha
    au += 6;                      /* skip over `Digest' */
    while (extract_param (&au, &name, &value, ','))
      {
-       int i;
+       size_t i;
+       size_t namelen = name.e - name.b;
        for (i = 0; i < countof (options); i++)
-         if (name.e - name.b == strlen (options[i].name)
-             && 0 == strncmp (name.b, options[i].name, name.e - name.b))
+         if (namelen == strlen (options[i].name)
+             && 0 == strncmp (name.b, options[i].name,
+                              namelen))
            {
              *options[i].variable = strdupdelim (value.b, value.e);
              break;
@@@ -3125,9 -3104,10 +3127,10 @@@ username=\"%s\", realm=\"%s\", nonce=\"
     first argument and are followed by whitespace or terminating \0.
     The comparison is case-insensitive.  */
  #define STARTS(literal, b, e)                           \
-   ((e) - (b) >= STRSIZE (literal)                       \
+   ((e > b) \
+    && ((size_t) ((e) - (b))) >= STRSIZE (literal)   \
     && 0 == strncasecmp (b, literal, STRSIZE (literal))  \
-    && ((e) - (b) == STRSIZE (literal)                   \
+    && ((size_t) ((e) - (b)) == STRSIZE (literal)          \
         || c_isspace (b[STRSIZE (literal)])))
  
  static bool
diff --combined src/init.c
index 8e8ed48838c7990dd3301104793f22992b1b55b4,5b0206e4498408faa1b6a6b1170d6224fb77b5ff..2aa8e133b17275474bc89090521a9f8684ea1ab8
@@@ -181,15 -181,9 +181,15 @@@ static const struct 
    { "inet6only",        &opt.ipv6_only,         cmd_boolean },
  #endif
    { "input",            &opt.input_filename,    cmd_file },
 +#ifdef ENABLE_IRI
 +  { "iri",              &opt.enable_iri,        cmd_boolean },
 +#endif
    { "keepsessioncookies", &opt.keep_session_cookies, cmd_boolean },
    { "limitrate",        &opt.limit_rate,        cmd_bytes },
    { "loadcookies",      &opt.cookies_input,     cmd_file },
 +#ifdef ENABLE_IRI
 +  { "locale",           &opt.locale,            cmd_string },
 +#endif
    { "logfile",          &opt.lfilename,         cmd_file },
    { "login",            &opt.ftp_user,          cmd_string },/* deprecated*/
    { "maxredirect",      &opt.max_redirect,      cmd_number },
    { "referer",          &opt.referer,           cmd_string },
    { "reject",           &opt.rejects,           cmd_vector },
    { "relativeonly",     &opt.relative_only,     cmd_boolean },
 +#ifdef ENABLE_IRI
 +  { "remoteencoding",   &opt.encoding_remote,   cmd_string },
 +#endif
    { "removelisting",    &opt.remove_listing,    cmd_boolean },
    { "restrictfilenames", NULL,                  cmd_spec_restrict_file_names },
    { "retrsymlinks",     &opt.retr_symlinks,     cmd_boolean },
@@@ -640,7 -631,7 +640,7 @@@ parse_line (const char *line, char **co
  static bool
  setval_internal (int comind, const char *com, const char *val)
  {
-   assert (0 <= comind && comind < countof (commands));
+   assert (0 <= comind && ((size_t) comind) < countof (commands));
    DEBUGP (("Setting %s (%s) to %s\n", com, commands[comind].name, val));
    return commands[comind].action (com, val, commands[comind].place);
  }
diff --combined src/main.c
index 4f0336975ee730a1e1ca2aacb558eef53d6bf1ee,28b04b30114f66bd876a5280846956f9583dff46..0727b1db5ac3d85bbb095fdca1cf699e45e612f6
@@@ -43,9 -43,6 +43,9 @@@ as that of the covered work.  *
  #include <assert.h>
  #include <errno.h>
  #include <time.h>
 +#ifdef ENABLE_IRI
 +#include <langinfo.h>
 +#endif
  
  #include "utils.h"
  #include "init.h"
@@@ -193,16 -190,10 +193,16 @@@ static struct cmdline_option option_dat
      { "inet6-only", '6', OPT_BOOLEAN, "inet6only", -1 },
  #endif
      { "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 },
      { "level", 'l', OPT_VALUE, "reclevel", -1 },
      { "limit-rate", 0, OPT_VALUE, "limitrate", -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 },
      { "mirror", 'm', OPT_BOOLEAN, "mirror", -1 },
      { "no", 'n', OPT__NO, NULL, required_argument },
      { "referer", 0, OPT_VALUE, "referer", -1 },
      { "reject", 'R', OPT_VALUE, "reject", -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 },
      { "restrict-file-names", 0, OPT_BOOLEAN, "restrictfilenames", -1 },
      { "retr-symlinks", 0, OPT_BOOLEAN, "retrsymlinks", -1 },
@@@ -306,7 -294,7 +306,7 @@@ static voi
  init_switches (void)
  {
    char *p = short_options;
-   int i, o = 0;
+   size_t i, o = 0;
    for (i = 0; i < countof (option_data); i++)
      {
        struct cmdline_option *opt = &option_data[i];
@@@ -652,7 -640,7 +652,7 @@@ Recursive accept/reject:\n")
      N_("Mail bug reports and suggestions to <bug-wget@gnu.org>.\n")
    };
  
-   int i;
+   size_t i;
  
    printf (_("GNU Wget %s, a non-interactive network retriever.\n"),
            version_string);
@@@ -959,24 -947,6 +959,24 @@@ for details.\n\n"))
        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)
      {
        opt.passwd = prompt_for_password ();
    if (opt.output_document)
      {
        if (HYPHENP (opt.output_document))
-         output_stream = stdout;
+         {
+ #ifdef WINDOWS
+           FILE *result;
+           result = freopen (NULL, "wb", stdout);
+           if (result == NULL)
+             {
+               logputs (LOG_NOTQUIET, _("\
+ WARNING: Can't reopen standard output in binary mode;\n\
+          downloaded file may contain inappropriate line endings.\n"));
+             }
+ #endif
+           output_stream = stdout;
+         }
        else
          {
            struct_fstat st;