]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_operate: Moved initial config setup into new init_config() function
authorSteve Holme <steve_holme@hotmail.com>
Sat, 1 Feb 2014 13:36:48 +0000 (13:36 +0000)
committerSteve Holme <steve_holme@hotmail.com>
Sun, 2 Feb 2014 10:18:21 +0000 (10:18 +0000)
src/tool_cfgable.c
src/tool_operate.c

index 5ee46871c97e6d567577de97f75fbae8bb9866dc..c47978612162c28af425d0e23192b0bcc98626dc 100644 (file)
@@ -22,6 +22,7 @@
 #include "tool_setup.h"
 
 #include "tool_cfgable.h"
+#include "tool_main.h"
 
 #include "memdebug.h" /* keep this as LAST include */
 
@@ -30,6 +31,16 @@ void init_config(struct Configurable* config)
   memset(config, 0, sizeof(struct Configurable));
 
   config->errors = stderr; /* default errors to stderr */
+  config->postfieldsize = -1;
+  config->showerror = -1; /* will show errors */
+  config->use_httpget = FALSE;
+  config->create_dirs = FALSE;
+  config->maxredirs = DEFAULT_MAXREDIRS;
+  config->proto = CURLPROTO_ALL; /* FIXME: better to read from library */
+  config->proto_present = FALSE;
+  config->proto_redir =
+    CURLPROTO_ALL & ~(CURLPROTO_FILE|CURLPROTO_SCP); /* not FILE or SCP */
+  config->proto_redir_present = FALSE;
 }
 
 void free_config_fields(struct Configurable *config)
index 801e5d47b17505615675ddb9578e9e2b0a986634..dd6d37f297884ed858969645f153b85d3273a14a 100644 (file)
@@ -253,18 +253,6 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
   setlocale(LC_ALL, "");
 #endif
 
-  /* inits */
-  config->postfieldsize = -1;
-  config->showerror = -1; /* will show errors */
-  config->use_httpget = FALSE;
-  config->create_dirs = FALSE;
-  config->maxredirs = DEFAULT_MAXREDIRS;
-  config->proto = CURLPROTO_ALL; /* FIXME: better to read from library */
-  config->proto_present = FALSE;
-  config->proto_redir =
-    CURLPROTO_ALL & ~(CURLPROTO_FILE|CURLPROTO_SCP); /* not FILE or SCP */
-  config->proto_redir_present = FALSE;
-
   if((argc > 1) &&
      (!curlx_strnequal("--", argv[1], 2) && (argv[1][0] == '-')) &&
      strchr(argv[1], 'q')) {