applied patch #1381929 - StrCmpS - case-sensitive string comparison
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4468 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
817378e7e3
commit
58b07e69c6
6 changed files with 23 additions and 4 deletions
|
@ -300,3 +300,9 @@ Compares (case insensitively) str1 to str2. If str1 and str2 are equal, Gotos ju
|
|||
\c DetailPrint '$$0 == "a string"'
|
||||
\c Goto +2
|
||||
\c DetailPrint '$$0 != "a string"'
|
||||
|
||||
\S2{strcmps} StrCmpS
|
||||
|
||||
\c str1 str2 jump_if_equal [jump_if_not_equal]
|
||||
|
||||
Same as \R{strcmp}{StrCmp}, but case sensitive.
|
||||
|
|
|
@ -581,10 +581,18 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
}
|
||||
}
|
||||
break;
|
||||
case EW_STRCMP: {
|
||||
case EW_STRCMP:
|
||||
{
|
||||
char *buf2=GetStringFromParm(0x20);
|
||||
char *buf3=GetStringFromParm(0x31);
|
||||
if (!lstrcmpi(buf2,buf3)) return parm2;
|
||||
if (!parm4) {
|
||||
// case insensitive
|
||||
if (!lstrcmpi(buf2,buf3)) return parm2;
|
||||
}
|
||||
else {
|
||||
// case sensitive
|
||||
if (!lstrcmp(buf2,buf3)) return parm2;
|
||||
}
|
||||
}
|
||||
return parm3;
|
||||
#endif//NSIS_SUPPORT_STROPTS
|
||||
|
|
|
@ -73,7 +73,7 @@ enum
|
|||
#ifdef NSIS_SUPPORT_STROPTS
|
||||
EW_STRLEN, // StrLen: 2 [output, input]
|
||||
EW_ASSIGNVAR, // Assign: 4 [variable (0-9) to assign, string to assign, maxlen, startpos]
|
||||
EW_STRCMP, // StrCmp: 4 [str1, str2, jump_if_equal, jump_if_not_equal] (case-insensitive)
|
||||
EW_STRCMP, // StrCmp: 5 [str1, str2, jump_if_equal, jump_if_not_equal, case-sensitive?]
|
||||
#endif
|
||||
#ifdef NSIS_SUPPORT_ENVIRONMENT
|
||||
EW_READENVSTR, // ReadEnvStr/ExpandEnvStrings: 3 [output, string_with_env_variables, IsRead]
|
||||
|
|
|
@ -4476,12 +4476,14 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
SCRIPT_MSG("GetCurrentAddress: %s",line.gettoken_str(1));
|
||||
return add_entry(&ent);
|
||||
case TOK_STRCMP:
|
||||
case TOK_STRCMPS:
|
||||
ent.which=EW_STRCMP;
|
||||
ent.offsets[0]=add_string(line.gettoken_str(1));
|
||||
ent.offsets[1]=add_string(line.gettoken_str(2));
|
||||
ent.offsets[4]=which_token == TOK_STRCMPS;
|
||||
if (process_jump(line,3,&ent.offsets[2]) ||
|
||||
process_jump(line,4,&ent.offsets[3])) PRINTHELP()
|
||||
SCRIPT_MSG("StrCmp \"%s\" \"%s\" equal=%s, nonequal=%s\n",line.gettoken_str(1),line.gettoken_str(2), line.gettoken_str(3),line.gettoken_str(4));
|
||||
SCRIPT_MSG("%s \"%s\" \"%s\" equal=%s, nonequal=%s\n",line.gettoken_str(0),line.gettoken_str(1),line.gettoken_str(2), line.gettoken_str(3),line.gettoken_str(4));
|
||||
return add_entry(&ent);
|
||||
case TOK_GETDLLVERSIONLOCAL:
|
||||
{
|
||||
|
@ -4695,6 +4697,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
case TOK_STRLEN:
|
||||
case TOK_STRCPY:
|
||||
case TOK_STRCMP:
|
||||
case TOK_STRCMPS:
|
||||
ERROR_MSG("Error: %s specified, NSIS_SUPPORT_STROPTS not defined.\n", line.gettoken_str(0));
|
||||
return PS_ERROR;
|
||||
#endif//!NSIS_SUPPORT_STROPTS
|
||||
|
|
|
@ -196,6 +196,7 @@ static tokenType tokenlist[TOK__LAST] =
|
|||
{TOK_SILENTUNINST,"SilentUnInstall",1,0,"(normal|silent)",TP_GLOBAL},
|
||||
{TOK_SLEEP,"Sleep",1,0,"sleep_time_in_ms",TP_CODE},
|
||||
{TOK_STRCMP,"StrCmp",3,1,"str1 str2 label_to_goto_if_equal [label_to_goto_if_not]",TP_CODE},
|
||||
{TOK_STRCMPS,"StrCmpS",3,1,"str1 str2 label_to_goto_if_equal [label_to_goto_if_not]",TP_CODE},
|
||||
{TOK_STRCPY,"StrCpy",2,2,"$(user_var: output) str [maxlen] [startoffset]",TP_CODE},
|
||||
{TOK_STRLEN,"StrLen",2,0,"$(user_var: length output) str",TP_CODE},
|
||||
{TOK_SUBCAPTION,"SubCaption",2,0,"page_number(0-4) new_subcaption",TP_GLOBAL},
|
||||
|
|
|
@ -176,6 +176,7 @@ enum
|
|||
TOK_IFABORT,
|
||||
TOK_STRCPY,
|
||||
TOK_STRCMP,
|
||||
TOK_STRCMPS,
|
||||
TOK_GETTEMPFILENAME,
|
||||
TOK_GETFUNCTIONADDR,
|
||||
TOK_GETLABELADDR,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue