aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2000-10-06 12:45:05 +0000
committerDaniel Stenberg <daniel@haxx.se>2000-10-06 12:45:05 +0000
commit5b39a48e22b95d23aa1066cf98cc0ad5f62eba4e (patch)
treed16b2ca22cde49bed3a20c71aa05e4717289c677
parent2918836cefdeec94ac8cb2cd7e25199230e3f847 (diff)
corrected the --longoption parser
-rw-r--r--src/main.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main.c b/src/main.c
index 7c16e8ae8..6b596c3de 100644
--- a/src/main.c
+++ b/src/main.c
@@ -504,23 +504,26 @@ static int getparameter(char *flag, /* f or -long-flag */
if('-' == flag[0]) {
/* try a long name */
int fnam=strlen(&flag[1]);
+ int numhits=0;
for(j=0; j< sizeof(aliases)/sizeof(aliases[0]); j++) {
if(strnequal(aliases[j].lname, &flag[1], fnam)) {
longopt = TRUE;
+ numhits++;
if(strequal(aliases[j].lname, &flag[1])) {
parse = aliases[j].letter;
hit = j;
+ numhits = 1; /* a single unique hit */
break;
}
- if(parse) {
- /* this is the second match, we can't continue! */
- helpf("option --%s is ambiguous\n", &flag[1]);
- return CURLE_FAILED_INIT;
- }
parse = aliases[j].letter;
hit = j;
}
}
+ if(numhits>1) {
+ /* this is at least the second match! */
+ helpf("option --%s is ambiguous\n", &flag[1]);
+ return CURLE_FAILED_INIT;
+ }
if(hit < 0) {
helpf("unknown option -%s.\n", flag);
return CURLE_FAILED_INIT;