diff --git a/Docs/src/flowcontrol.but b/Docs/src/flowcontrol.but index 195a852b..5e0ecaf8 100644 --- a/Docs/src/flowcontrol.but +++ b/Docs/src/flowcontrol.but @@ -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. diff --git a/Source/exehead/exec.c b/Source/exehead/exec.c index 7db47bcc..8621020b 100644 --- a/Source/exehead/exec.c +++ b/Source/exehead/exec.c @@ -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 diff --git a/Source/exehead/fileform.h b/Source/exehead/fileform.h index 3e741ea1..ae94879a 100644 --- a/Source/exehead/fileform.h +++ b/Source/exehead/fileform.h @@ -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] diff --git a/Source/script.cpp b/Source/script.cpp index 86be6482..356c5c4a 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -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 diff --git a/Source/tokens.cpp b/Source/tokens.cpp index b2a2cef7..00ce420b 100644 --- a/Source/tokens.cpp +++ b/Source/tokens.cpp @@ -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}, diff --git a/Source/tokens.h b/Source/tokens.h index 0919babd..26a8351e 100644 --- a/Source/tokens.h +++ b/Source/tokens.h @@ -176,6 +176,7 @@ enum TOK_IFABORT, TOK_STRCPY, TOK_STRCMP, + TOK_STRCMPS, TOK_GETTEMPFILENAME, TOK_GETFUNCTIONADDR, TOK_GETLABELADDR,