tool_operate: Changed the required argument check/get to be upfront
authorSteve Holme <steve_holme@hotmail.com>
Fri, 14 Feb 2014 22:05:27 +0000 (22:05 +0000)
committerSteve Holme <steve_holme@hotmail.com>
Sat, 15 Feb 2014 18:59:12 +0000 (18:59 +0000)
Rather than check for required arguments, and prompt for any host and
proxy passwords, as each operation is performed, changed the code so
all configurations are checked before any operations are performed.

This allows the user to input all the required passwords, for example,
upfront rather than wait for each operation.

src/tool_operate.c

index fc54819..6e07157 100644 (file)
@@ -234,11 +234,6 @@ static int operate_do(struct Configurable *config)
   ** from outside of nested loops further down below.
   */
 
-  /* Get the required aguments */
-  res = get_args(config);
-  if(res)
-    goto quit_curl;
-
   /* Check we have a url */
   if(!config->url_list || !config->url_list->url) {
     helpf(config->errors, "no URL specified!\n");
@@ -1845,6 +1840,17 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
     else {
       struct Configurable *operation = config;
 
+      /* Get the required aguments for each operation */
+      while(!result && operation) {
+        result = get_args(operation);
+
+        operation = operation->next;
+      }
+
+      /* Reset the operation pointer */
+      operation = config;
+
+      /* Perform each operation */
       while(!result && operation) {
         result = operate_do(operation);