]> sjero.net Git - wget/blobdiff - src/main.c
Avoid unnecessary vars, and make wgetrc_file_name build properly on Windows.
[wget] / src / main.c
index a7c00b1cbc5372c32589ae8f7710b9a888d16452..268a603ffbd144375520bd59e0ab59998976f2b3 100644 (file)
@@ -72,8 +72,6 @@ extern char *system_getrc;
 extern char *link_string;
 /* defined in build_info.c */
 extern char *compiled_features[];
-extern char *system_wgetrc;
-extern char *locale_dir;
 /* Used for --version output in print_version */
 static const int max_chars_per_line = 72;
 
@@ -743,6 +741,10 @@ format_and_print_line (char* prefix, char* line,
     }
 
   printf ("\n");
+
+  /* FIXME: Responsibility for deallocation should be handled by
+     whatever allocated it, wherever possible. These two lines result
+     in unnecessary strdup calls in the print_version function. */
   xfree (prefix);
   xfree (line);
 }
@@ -794,10 +796,12 @@ print_version (void)
       printf ("%s (user)\n%s", user_wgetrc, prefix_spaces);
       xfree (user_wgetrc);
     }
-  printf ("%s (system)\n", system_wgetrc);
+#ifdef SYSTEM_WGETRC
+  printf ("%s (system)\n", SYSTEM_WGETRC);
+#endif
 
   format_and_print_line (strdup (locale_title),
-                        strdup (locale_dir), 
+                        strdup (LOCALEDIR), 
                         max_chars_per_line);
   
   format_and_print_line (strdup (compile_title),
@@ -826,6 +830,8 @@ There is NO WARRANTY, to the extent permitted by law.\n"), stdout);
   exit (0);
 }
 
+char *program_name; /* Needed by lib/error.c. */
+
 int
 main (int argc, char **argv)
 {
@@ -834,6 +840,8 @@ main (int argc, char **argv)
   int nurl, status;
   bool append_to_log = false;
 
+  program_name = argv[0];
+
   i18n_initialize ();
 
   /* Construct the name of the executable, without the directory part.  */
@@ -1241,9 +1249,6 @@ WARNING: Can't reopen standard output in binary mode;\n\
     xfree (url[i]);
   cleanup ();
 
-#ifdef DEBUG_MALLOC
-  print_malloc_debug_stats ();
-#endif
   if (status == RETROK)
     return 0;
   else