]> sjero.net Git - wget/blobdiff - src/init.c
[svn] Merge of fix for bugs 20341 and 20410.
[wget] / src / init.c
index fccc4581f0e94bb8074b8a1dd674ac4a230b1952..6ad97f3645100b745090c6e21ac5789cd4b519e9 100644 (file)
@@ -1,11 +1,11 @@
 /* Reading/parsing the initialization file.
-   Copyright (C) 1996-2005 Free Software Foundation, Inc.
+   Copyright (C) 1996-2006 Free Software Foundation, Inc.
 
 This file is part of GNU Wget.
 
 GNU Wget is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
+the Free Software Foundation; either version 3 of the License, or
 (at your option) any later version.
 
 GNU Wget is distributed in the hope that it will be useful,
@@ -14,8 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with Wget; if not, write to the Free Software Foundation, Inc.,
-51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+along with Wget.  If not, see <http://www.gnu.org/licenses/>.
 
 In addition, as a special exception, the Free Software Foundation
 gives permission to link the code of its release of Wget with the
@@ -100,15 +99,16 @@ CMD_DECLARE (cmd_spec_verbose);
 /* List of recognized commands, each consisting of name, place and
    function.  When adding a new command, simply add it to the list,
    but be sure to keep the list sorted alphabetically, as
-   command_by_name depends on it.  Also, be sure to add any entries
-   that allocate memory (e.g. cmd_string and cmd_vector) to the
-   cleanup() function below. */
+   command_by_name's binary search depends on it.  Also, be sure to
+   add any entries that allocate memory (e.g. cmd_string and
+   cmd_vector) to the cleanup() function below. */
 
 static struct {
   const char *name;
   void *place;
   bool (*action) (const char *, const char *, void *);
 } commands[] = {
+  /* KEEP THIS LIST ALPHABETICALLY SORTED */
   { "accept",          &opt.accepts,           cmd_vector },
   { "addhostdir",      &opt.add_hostdir,       cmd_boolean },
   { "alwaysrest",      &opt.always_rest,       cmd_boolean }, /* deprecated */
@@ -128,9 +128,9 @@ static struct {
   { "checkcertificate", &opt.check_cert,       cmd_boolean },
 #endif
   { "connecttimeout",  &opt.connect_timeout,   cmd_time },
+  { "contentdisposition", &opt.content_disposition, cmd_boolean },
   { "continue",                &opt.always_rest,       cmd_boolean },
   { "convertlinks",    &opt.convert_links,     cmd_boolean },
-  { "contentdisposition", &opt.content_disposition, cmd_boolean },
   { "cookies",         &opt.cookies,           cmd_boolean },
   { "cutdirs",         &opt.cut_dirs,          cmd_number },
 #ifdef ENABLE_DEBUG
@@ -1134,10 +1134,11 @@ cmd_spec_prefer_family (const char *com, const char *val, void *place_ignored)
     { "IPv6", prefer_ipv6 },
     { "none", prefer_none },
   };
-  int ok = decode_string (val, choices, countof (choices),
-                         (int *) &opt.prefer_family);
+  int prefer_family = prefer_ipv4;
+  int ok = decode_string (val, choices, countof (choices), &prefer_family);
   if (!ok)
     fprintf (stderr, _("%s: %s: Invalid value `%s'.\n"), exec_name, com, val);
+  opt.prefer_family = prefer_family;
   return ok;
 }