Skip to content
Snippets Groups Projects
Commit f28907e3 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Fix the auto-keyword detection based on parameter type for USER, DIR, and SUB

SUB and DIR have long had this bug, but I just noticed while playing with the
new USER keyword capabilities (specifying user numbers and/or names).

If you switched between numeric and alpha/string parameters, without restating
the ARS keyword, the keyword would could end up wrong in the parsed byte array.
parent b3962465
No related branches found
No related tags found
No related merge requests found
Pipeline #7733 passed
......@@ -547,12 +547,21 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf)
arg_expected=FALSE;
if(artype==AR_SUB && !IS_DIGIT(str[i]))
artype=AR_SUBCODE;
if(artype==AR_DIR && !IS_DIGIT(str[i]))
artype=AR_DIRCODE;
if(artype==AR_USER && !IS_DIGIT(str[i]))
artype=AR_USERNAME;
// Auto-detect AR keyword base on parameter class (numeric or alpha)
switch(artype) {
case AR_SUB:
case AR_SUBCODE:
artype = IS_DIGIT(str[i]) ? AR_SUB : AR_SUBCODE;
break;
case AR_DIR:
case AR_DIRCODE:
artype = IS_DIGIT(str[i]) ? AR_DIR : AR_DIRCODE;
break;
case AR_USER:
case AR_USERNAME:
artype = IS_DIGIT(str[i]) ? AR_USER : AR_USERNAME;
break;
}
if(artype==AR_INVALID)
artype=AR_LEVEL;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment