mirror of
https://github.com/curl/curl.git
synced 2025-03-01 15:15:34 +08:00
made "short options" possible to specify -m20 as well as -m 200.
This commit is contained in:
parent
f5aa7f64bd
commit
27f8cf6dfc
10
src/main.c
10
src/main.c
@ -510,6 +510,8 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
time_t now;
|
time_t now;
|
||||||
int hit=-1;
|
int hit=-1;
|
||||||
bool longopt=FALSE;
|
bool longopt=FALSE;
|
||||||
|
bool singleopt=FALSE; /* when true means '-o foo' used '-ofoo' */
|
||||||
|
|
||||||
|
|
||||||
/* single-letter,
|
/* single-letter,
|
||||||
long-name,
|
long-name,
|
||||||
@ -640,7 +642,11 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
if(hit < 0) {
|
if(hit < 0) {
|
||||||
return PARAM_OPTION_UNKNOWN;
|
return PARAM_OPTION_UNKNOWN;
|
||||||
}
|
}
|
||||||
if((!nextarg || !*nextarg) && aliases[hit].extraparam) {
|
if(!longopt && flag[1]) {
|
||||||
|
nextarg=&flag[1]; /* this is the actual extra parameter */
|
||||||
|
singleopt=TRUE; /* don't loop anymore after this */
|
||||||
|
}
|
||||||
|
else if((!nextarg || !*nextarg) && aliases[hit].extraparam) {
|
||||||
return PARAM_REQUIRES_PARAMETER;
|
return PARAM_REQUIRES_PARAMETER;
|
||||||
}
|
}
|
||||||
else if(nextarg && aliases[hit].extraparam)
|
else if(nextarg && aliases[hit].extraparam)
|
||||||
@ -1056,7 +1062,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
}
|
}
|
||||||
hit = -1;
|
hit = -1;
|
||||||
|
|
||||||
} while(*++parse && !*usedarg);
|
} while(!singleopt && *++parse && !*usedarg);
|
||||||
|
|
||||||
return PARAM_OK;
|
return PARAM_OK;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user