]> sjero.net Git - wget/blobdiff - src/main.c
[svn] New option --protocol-directories.
[wget] / src / main.c
index 0fb65f3b655d2f4f2ab3852661d88d0770b07b57..6391ebf2cbd34ad3483d1c87d5b7ff774ac84f3c 100644 (file)
@@ -216,6 +216,7 @@ struct cmdline_option option_data[] =
     { "post-file", 0, OPT_VALUE, "postfile", -1 },
     { "preserve-permissions", 0, OPT_BOOLEAN, "preservepermissions", -1 },
     { "progress", 0, OPT_VALUE, "progress", -1 },
+    { "protocol-directories", 0, OPT_BOOLEAN, "protocoldirectories", -1 },
     { "proxy", 'Y', OPT_BOOLEAN, "useproxy", -1 },
     { "proxy-passwd", 0, OPT_VALUE, "proxypasswd", -1 },
     { "proxy-user", 0, OPT_VALUE, "proxyuser", -1 },
@@ -475,6 +476,8 @@ Directories:\n"),
   -x,  --force-directories        force creation of directories.\n"),
     N_("\
   -nH, --no-host-directories      don't create host directories.\n"),
+    N_("\
+       --protocol-directories     use protocol name in directories.\n"),
     N_("\
   -P,  --directory-prefix=PREFIX  save files to PREFIX/...\n"),
     N_("\
@@ -547,13 +550,13 @@ HTTPS (SSL) options:\n"),
     N_("\
 FTP options:\n"),
     N_("\
-       --no-remove-listing  don't remove `.listing' files.\n"),
+       --no-remove-listing     don't remove `.listing' files.\n"),
     N_("\
-       --no-glob            turn off FTP file name globbing.\n"),
+       --no-glob               turn off FTP file name globbing.\n"),
     N_("\
-       --passive-ftp        use the \"passive\" transfer mode.\n"),
+       --passive-ftp           use the \"passive\" transfer mode.\n"),
     N_("\
-       --retr-symlinks      when recursing, get linked-to files (not dir).\n"),
+       --retr-symlinks         when recursing, get linked-to files (not dir).\n"),
     N_("\
        --preserve-permissions  preserve remote file permissions.\n"),
     "\n",
@@ -671,18 +674,21 @@ main (int argc, char *const *argv)
     {
       int val;
       struct cmdline_option *opt;
-      if (ret == '?')
-       {
-         print_usage ();
-         printf ("\n");
-         printf (_("Try `%s --help' for more options.\n"), exec_name);
-         exit (2);
-       }
 
       /* If LONGINDEX is unchanged, it means RET is referring a short
-        option.  Look it up in the mapping table.  */
+        option.  */
       if (longindex == -1)
-       longindex = optmap[ret - 32];
+       {
+         if (ret == '?')
+           {
+             print_usage ();
+             printf ("\n");
+             printf (_("Try `%s --help' for more options.\n"), exec_name);
+             exit (2);
+           }
+         /* Find the short option character in the mapping.  */
+         longindex = optmap[ret - 32];
+       }
       val = long_options[longindex].val;
 
       /* Use the retrieved value to locate the option in the
@@ -807,12 +813,14 @@ Can't timestamp and not clobber old files at the same time.\n"));
       print_usage ();
       exit (1);
     }
+#ifdef ENABLE_IPV6
   if (opt.ipv4_only && opt.ipv6_only)
     {
       printf (_("Cannot specify both --inet4-only and --inet6-only.\n"));
       print_usage ();
       exit (1);
     }
+#endif
 
   nurl = argc - optind;
   if (!nurl && !opt.input_filename)
@@ -862,19 +870,23 @@ Can't timestamp and not clobber old files at the same time.\n"));
   /* Open the output filename if necessary.  */
   if (opt.output_document)
     {
+      extern FILE *output_stream;
+      extern int output_stream_regular;
+
       if (HYPHENP (opt.output_document))
-       opt.dfp = stdout;
+       output_stream = stdout;
       else
        {
          struct stat st;
-         opt.dfp = fopen (opt.output_document, opt.always_rest ? "ab" : "wb");
-         if (opt.dfp == NULL)
+         output_stream = fopen (opt.output_document,
+                                opt.always_rest ? "ab" : "wb");
+         if (output_stream == NULL)
            {
              perror (opt.output_document);
              exit (1);
            }
-         if (fstat (fileno (opt.dfp), &st) == 0 && S_ISREG (st.st_mode))
-           opt.od_known_regular = 1;
+         if (fstat (fileno (output_stream), &st) == 0 && S_ISREG (st.st_mode))
+           output_stream_regular = 1;
        }
     }