]> sjero.net Git - wget/blobdiff - src/main.c
[svn] Fix -O timestamp bug.
[wget] / src / main.c
index 300a82e4bb181a4c1c4bc0e6b17195c6769bc079..221ac5ae3d93824a0407d9112ca0c4f9053a8a24 100644 (file)
@@ -97,6 +97,20 @@ i18n_initialize (void)
   textdomain ("wget");
 #endif /* HAVE_NLS */
 }
+
+/* It's kosher to declare these here because their interface _has_ to
+   be void foo(void).  */
+void url_init PARAMS ((void));
+void host_init PARAMS ((void));
+
+/* This just calls the various initialization functions from the
+   modules that need one-time initialization. */
+static void
+private_initialize (void)
+{
+  url_init ();
+  host_init ();
+}
 \f
 /* Print the usage message.  */
 static void
@@ -148,7 +162,7 @@ Download:\n\
        --spider                 don\'t download anything.\n\
   -T,  --timeout=SECONDS        set the read timeout to SECONDS.\n\
   -w,  --wait=SECONDS           wait SECONDS between retrievals.\n\
-       --waitretry=SECONDS     wait 1...SECONDS between retries of a retrieval.\n\
+       --waitretry=SECONDS      wait 1...SECONDS between retries of a retrieval.\n\
   -Y,  --proxy=on/off           turn proxy on or off.\n\
   -Q,  --quota=NUMBER           set retrieval quota to NUMBER.\n\
 \n"),  _("\
@@ -233,6 +247,7 @@ main (int argc, char *const *argv)
     { "no-directories", no_argument, NULL, 19 },
     { "no-host-directories", no_argument, NULL, 20 },
     { "no-host-lookup", no_argument, NULL, 22 },
+    { "no-http-keep-alive", no_argument, NULL, 28 },
     { "no-parent", no_argument, NULL, 5 },
     { "non-verbose", no_argument, NULL, 18 },
     { "passive-ftp", no_argument, NULL, 11 },
@@ -293,6 +308,7 @@ main (int argc, char *const *argv)
   };
 
   i18n_initialize ();
+  private_initialize ();
 
   append_to_log = 0;
 
@@ -370,6 +386,9 @@ hpVqvdkKsxmNWrHSLcFbEY:G:g:T:U:O:l:n:i:o:a:t:D:A:R:P:B:e:Q:X:I:w:",
        case 27:
          setval ("bindaddress", optarg);
          break;
+       case 28:
+         setval ("httpkeepalive", "off");
+         break;
        case 'b':
          setval ("background", "on");
          break;
@@ -516,8 +535,8 @@ GNU General Public License for more details.\n"));
                         optarg);
                exit (1);
              }
-           free (com);
-           free (val);
+           xfree (com);
+           xfree (val);
          }
          break;
        case 'G':
@@ -564,6 +583,9 @@ GNU General Public License for more details.\n"));
                case 'p':
                  setval ("noparent", "on");
                  break;
+               case 'k':
+                 setval ("httpkeepalive", "off");
+                 break;
                default:
                  printf (_("%s: illegal option -- `-n%c'\n"), exec_name, *p);
                  print_usage ();
@@ -704,12 +726,15 @@ Can't timestamp and not clobber old files at the same time.\n"));
        opt.dfp = stdout;
       else
        {
+         struct stat st;
          opt.dfp = fopen (opt.output_document, "wb");
          if (opt.dfp == NULL)
            {
              perror (opt.output_document);
              exit (1);
            }
+         if (fstat (fileno (opt.dfp), &st) == 0 && S_ISREG (st.st_mode))
+           opt.od_known_regular = 1;
        }
     }
 
@@ -787,6 +812,9 @@ Can't timestamp and not clobber old files at the same time.\n"));
     }
   log_close ();
   cleanup ();
+#ifdef DEBUG_MALLOC
+  print_malloc_debug_stats ();
+#endif
   if (status == RETROK)
     return 0;
   else