ParameterError getparameter(const char *flag, /* f or -long-flag */
char *nextarg, /* NULL if unset */
+ argv_item_t cleararg,
bool *usedarg, /* set to TRUE if the arg
has been used */
struct GlobalConfig *global,
/* this option requires an extra parameter */
if(!longopt && parse[1]) {
nextarg = (char *)&parse[1]; /* this is the actual extra parameter */
-#ifdef HAVE_WRITABLE_ARGV
- clearthis = nextarg;
-#endif
singleopt = TRUE; /* don't loop anymore after this */
}
else if(!nextarg)
return PARAM_REQUIRES_PARAMETER;
- else
+ else {
+#ifdef HAVE_WRITABLE_ARGV
+ clearthis = cleararg;
+#endif
*usedarg = TRUE; /* mark it as used */
+ }
if((aliases[hit].desc == ARG_FILENAME) &&
(nextarg[0] == '-') && nextarg[1]) {
}
}
- result = getparameter(orig_opt, nextarg, &passarg,
+ result = getparameter(orig_opt, nextarg, argv[i + 1], &passarg,
global, config);
curlx_unicodefree(nextarg);
bool used;
/* Just add the URL please */
- result = getparameter("--url", orig_opt, &used, global, config);
+ result = getparameter("--url", orig_opt, argv[i], &used, global, config);
}
if(!result)
#ifdef DEBUG_CONFIG
fprintf(stderr, "PARAM: \"%s\"\n",(param ? param : "(null)"));
#endif
- res = getparameter(option, param, &usedarg, global, operation);
+ res = getparameter(option, param, NULL, &usedarg, global, operation);
operation = global->last;
if(!res && param && *param && !usedarg)