]> sjero.net Git - wget/blobdiff - src/main.c
Merge SFLC licensing changes for OpenSSL with tip.
[wget] / src / main.c
index 2c30843007fe500b4d976d6c0a04c1478e13a7ef..d2a55c51cb1e82a8fad90e46f3d95a7890f4eef7 100644 (file)
@@ -28,7 +28,7 @@ Corresponding Source for a non-source form of such a combination
 shall include the source code for the parts of OpenSSL used as well
 as that of the covered work.  */
 
-#include <config.h>
+#include "wget.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -37,14 +37,13 @@ as that of the covered work.  */
 #endif /* HAVE_UNISTD_H */
 #include <string.h>
 #include <signal.h>
-#ifdef HAVE_NLS
+#ifdef ENABLE_NLS
 # include <locale.h>
 #endif
 #include <assert.h>
 #include <errno.h>
 #include <time.h>
 
-#include "wget.h"
 #include "utils.h"
 #include "init.h"
 #include "retr.h"
@@ -56,8 +55,7 @@ as that of the covered work.  */
 #include "spider.h"
 #include "http.h"               /* for save_cookies */
 
-/* On GNU system this will include system-wide getopt.h. */
-#include "getopt.h"
+#include <getopt.h>
 
 #ifndef PATH_SEPARATOR
 # define PATH_SEPARATOR '/'
@@ -81,14 +79,14 @@ const char *exec_name;
 static void
 i18n_initialize (void)
 {
-  /* HAVE_NLS implies existence of functions invoked here.  */
-#ifdef HAVE_NLS
+  /* ENABLE_NLS implies existence of functions invoked here.  */
+#ifdef ENABLE_NLS
   /* Set the current locale.  */
   setlocale (LC_ALL, "");
   /* Set the text message domain.  */
   bindtextdomain ("wget", LOCALEDIR);
   textdomain ("wget");
-#endif /* HAVE_NLS */
+#endif /* ENABLE_NLS */
 }
 \f
 /* Definition of command-line options. */
@@ -691,7 +689,7 @@ There is NO WARRANTY, to the extent permitted by law.\n"), stdout);
 \f
 
 int
-main (int argc, char *const *argv)
+main (int argc, char **argv)
 {
   char **url, **t;
   int i, ret, longindex;
@@ -709,7 +707,7 @@ main (int argc, char *const *argv)
 
 #ifdef WINDOWS
   /* Drop extension (typically .EXE) from executable filename. */
-  windows_main (&argc, (char **) argv, (char **) &exec_name);
+  windows_main ((char **) &exec_name);
 #endif
 
   /* Set option defaults; read the system wgetrc and ~/.wgetrc.  */
@@ -813,9 +811,9 @@ main (int argc, char *const *argv)
                before passing the value to setoptval.  */
             bool flag = true;
             if (optarg)
-              flag = (*optarg == '1' || TOLOWER (*optarg) == 'y'
-                      || (TOLOWER (optarg[0]) == 'o'
-                          && TOLOWER (optarg[1]) == 'n'));
+              flag = (*optarg == '1' || c_tolower (*optarg) == 'y'
+                      || (c_tolower (optarg[0]) == 'o'
+                          && c_tolower (optarg[1]) == 'n'));
             setoptval (opt->type == OPT__PARENT ? "noparent" : "noclobber",
                        flag ? "0" : "1", opt->long_name);
             break;
@@ -834,7 +832,10 @@ main (int argc, char *const *argv)
      interoption dependency checks. */
 
   if (opt.reclevel == 0)
-    opt.reclevel = INFINITE_RECURSION; /* see recur.h for commentary on this */
+      opt.reclevel = INFINITE_RECURSION; /* see recur.h for commentary */
+
+  if (opt.spider || opt.delete_after)
+      opt.no_dirstruct = true;
 
   if (opt.page_requisites && !opt.recursive)
     {