]> sjero.net Git - wget/blobdiff - src/init.c
Implement --config.
[wget] / src / init.c
index 22394d11d1c16ab985354f917e6721d78926acd0..ffdaa6d6a93c65fc1f7af6beb05b81287ab940fd 100644 (file)
@@ -32,6 +32,7 @@ as that of the covered work.  */
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdbool.h>
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
@@ -136,6 +137,7 @@ static const struct {
   { "certificatetype",  &opt.cert_type,         cmd_cert_type },
   { "checkcertificate", &opt.check_cert,        cmd_boolean },
 #endif
+  { "chooseconfig",     &opt.choose_config,    cmd_file },
   { "connecttimeout",   &opt.connect_timeout,   cmd_time },
   { "contentdisposition", &opt.content_disposition, cmd_boolean },
   { "continue",         &opt.always_rest,       cmd_boolean },
@@ -253,6 +255,7 @@ static const struct {
   { "timestamping",     &opt.timestamping,      cmd_boolean },
   { "tries",            &opt.ntry,              cmd_number_inf },
   { "trustservernames", &opt.trustservernames,  cmd_boolean },
+  { "unlink",           &opt.unlink,            cmd_boolean },
   { "useproxy",         &opt.use_proxy,         cmd_boolean },
   { "user",             &opt.user,              cmd_string },
   { "useragent",        NULL,                   cmd_spec_useragent },
@@ -290,7 +293,7 @@ command_by_name (const char *cmdname)
 }
 \f
 /* Reset the variables to default values.  */
-static void
+void
 defaults (void)
 {
   char *tmp;
@@ -430,7 +433,7 @@ wgetrc_env_file_name (void)
 char *
 wgetrc_user_file_name (void)
 {
-  char *home = home_dir ();
+  char *home;
   char *file = NULL;
   /* If that failed, try $HOME/.wgetrc (or equivalent).  */
 
@@ -509,7 +512,7 @@ static bool setval_internal_tilde (int, const char *, const char *);
 /* Initialize variables from a wgetrc file.  Returns zero (failure) if
    there were errors in the file.  */
 
-static bool
+bool
 run_wgetrc (const char *file)
 {
   FILE *fp;
@@ -573,10 +576,7 @@ void
 initialize (void)
 {
   char *file, *env_sysrc;
-  int ok = true;
-
-  /* Load the hard-coded defaults.  */
-  defaults ();
+  bool ok = true;
 
   /* Run a non-standard system rc file when the according environment
      variable has been set. For internal testing purposes only!  */
@@ -1577,6 +1577,7 @@ cleanup (void)
     extern acc_t *netrc_list;
     free_netrc (netrc_list);
   }
+  xfree_null (opt.choose_config);
   xfree_null (opt.lfilename);
   xfree_null (opt.dir_prefix);
   xfree_null (opt.input_filename);