aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tool_cfgable.c19
-rw-r--r--src/tool_cfgable.h7
-rw-r--r--src/tool_getparam.c30
-rw-r--r--src/tool_main.c2
-rw-r--r--tests/data/test8152
-rw-r--r--tests/data/test8162
6 files changed, 53 insertions, 9 deletions
diff --git a/src/tool_cfgable.c b/src/tool_cfgable.c
index 6bcf421b3..aed96a48b 100644
--- a/src/tool_cfgable.c
+++ b/src/tool_cfgable.c
@@ -153,6 +153,21 @@ static void free_config_fields(struct Configurable *config)
void config_free(struct Configurable *config)
{
- free_config_fields(config);
- free(config);
+ struct Configurable *last = config;
+
+ /* Find the last config structure */
+ while(last->next)
+ last = last->next;
+
+ /* Free each of the structures in reverse order */
+ do {
+ struct Configurable *prev = last->prev;
+ if(prev)
+ last->easy = NULL;
+
+ free_config_fields(last);
+ free(last);
+
+ last = prev;
+ } while(last);
}
diff --git a/src/tool_cfgable.h b/src/tool_cfgable.h
index 7ac4df7ea..6696dfb90 100644
--- a/src/tool_cfgable.h
+++ b/src/tool_cfgable.h
@@ -213,8 +213,11 @@ struct Configurable {
#ifdef CURLDEBUG
bool test_event_based;
#endif
- char *xoauth2_bearer; /* XOAUTH2 bearer token */
-}; /* struct Configurable */
+ char *xoauth2_bearer; /* XOAUTH2 bearer token */
+
+ struct Configurable* prev;
+ struct Configurable* next; /* Always last in the struct */
+};
void config_init(struct Configurable* config);
void config_free(struct Configurable* config);
diff --git a/src/tool_getparam.c b/src/tool_getparam.c
index 2938f88b2..e9ae7923a 100644
--- a/src/tool_getparam.c
+++ b/src/tool_getparam.c
@@ -1859,7 +1859,29 @@ ParameterError parse_args(struct Configurable *config, int argc,
for(i = 1, stillflags = TRUE; i < argc && !result; i++) {
orig_opt = argv[i];
- if(stillflags && ('-' == argv[i][0])) {
+ if(curlx_strequal(":", argv[i]) &&
+ ((config->url_list && config->url_list->url) || config->list_engines)) {
+
+ /* Allocate the next config */
+ config->next = malloc(sizeof(struct Configurable));
+ if(config->next) {
+ /* Initialise the newly created config */
+ config_init(config->next);
+
+ /* Copy the easy handle */
+ config->next->easy = config->easy;
+
+ /* Move onto the new config */
+ config->next->prev = config;
+ config = config->next;
+
+ /* Reset the flag indicator */
+ stillflags = TRUE;
+ }
+ else
+ result = PARAM_NO_MEM;
+ }
+ else if(stillflags && ('-' == argv[i][0])) {
char *nextarg;
bool passarg;
char *flag = argv[i];
@@ -1886,7 +1908,11 @@ ParameterError parse_args(struct Configurable *config, int argc,
if(result && result != PARAM_HELP_REQUESTED) {
const char *reason = param2text(result);
- helpf(config->errors, "option %s: %s\n", orig_opt, reason);
+
+ if(!curlx_strequal(":", orig_opt))
+ helpf(config->errors, "option %s: %s\n", orig_opt, reason);
+ else
+ helpf(config->errors, "%s\n", reason);
}
return result;
diff --git a/src/tool_main.c b/src/tool_main.c
index 9fde71807..ecf9f9f38 100644
--- a/src/tool_main.c
+++ b/src/tool_main.c
@@ -196,7 +196,7 @@ int main(int argc, char *argv[])
tool_pressanykey();
#endif
- /* Free the config structure */
+ /* Free the config structures */
config_free(config);
config = NULL;
}
diff --git a/tests/data/test815 b/tests/data/test815
index b7f5f495b..4ea279c8f 100644
--- a/tests/data/test815
+++ b/tests/data/test815
@@ -26,7 +26,7 @@ imap
IMAP delete message (CUSTOMREQUEST)
</name>
<command>
-imap://%HOSTIP:%IMAPPORT/815 -X 'STORE 123 +Flags \Deleted' -Q -CLOSE -u user:secret
+imap://%HOSTIP:%IMAPPORT/815 -X 'STORE 123 +Flags \Deleted' -u user:secret : imap://%HOSTIP:%IMAPPORT/815 -X CLOSE
</command>
</client>
diff --git a/tests/data/test816 b/tests/data/test816
index a5ff2b3c0..8fede7ca9 100644
--- a/tests/data/test816
+++ b/tests/data/test816
@@ -29,7 +29,7 @@ imap
IMAP delete message with confirmation (CUSTOMREQUEST)
</name>
<command>
-imap://%HOSTIP:%IMAPPORT/816 -X 'STORE 123 +Flags \Deleted' -Q -EXPUNGE -u user:secret
+imap://%HOSTIP:%IMAPPORT/816 -X 'STORE 123 +Flags \Deleted' -u user:secret : imap://%HOSTIP:%IMAPPORT/816 -X EXPUNGE
</command>
</client>