]> sjero.net Git - wget/commitdiff
[svn] Don't allow opt.ipv4_only and opt.ipv6_only to both be set.
authorhniksic <devnull@localhost>
Sun, 16 Nov 2003 00:31:58 +0000 (16:31 -0800)
committerhniksic <devnull@localhost>
Sun, 16 Nov 2003 00:31:58 +0000 (16:31 -0800)
src/ChangeLog
src/init.c
src/main.c

index d58e371e2d64ba4b7f49eb4960b3067443eef6e3..23e8a3e4b75d4314632a3627d6b4a05e8a2865d6 100644 (file)
@@ -1,3 +1,11 @@
+2003-11-16  Hrvoje Niksic  <hniksic@xemacs.org>
+
+       * main.c (main): Don't allow setting of both opt.ipv4_only and
+       opt.ipv6_only.
+
+       * init.c (defaults): Mark opt.ipv4_only specially when set
+       automatically.
+
 2003-11-15  Hrvoje Niksic  <hniksic@xemacs.org>
 
        * host.c (lookup_host): Use AI_ADDRCONFIG only if the family is
index e93d62268187a04833c94147b49c0d44394fffa7..220c8c00f8d7d998dafd5c50b4f9fdbd46b99e29 100644 (file)
@@ -321,7 +321,8 @@ defaults (void)
   {
     int sock = socket (AF_INET6, SOCK_STREAM, 0);
     if (sock < 0)
-      opt.ipv4_only = 1;
+      opt.ipv4_only = -1;      /* special value -1 because the option
+                                  was not specified by the user.  */
     else
       close (sock);
   }
index a857dcac6e3d56cc6cb81325bd5231e1909c6556..f702bd4b94a745f66457c4ce6e4e55636a168c24 100644 (file)
@@ -806,6 +806,18 @@ Can't timestamp and not clobber old files at the same time.\n"));
       print_usage ();
       exit (1);
     }
+  if (opt.ipv4_only && opt.ipv6_only)
+    {
+      if (opt.ipv4_only == -1)
+       /* ipv4_only was set automatically because the system doesn't
+          support IPv6.  */
+       printf (_("Cannot use --inet6-only on a system without IPv6 support.\n"));
+      else
+       printf (_("Cannot specify both --inet4-only and --inet6-only.\n"));
+      print_usage ();
+      exit (1);
+    }
+
   nurl = argc - optind;
   if (!nurl && !opt.input_filename)
     {