aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-08-04 13:58:23 +0000
committermarha <marha@users.sourceforge.net>2009-08-04 13:58:23 +0000
commit392f542ca74be7b3721e7a4af75544a39e0eceae (patch)
tree39e7d8d5625c8563de18bfd882543910ca69af84 /tools
parenta1c52b0d76b73151014d62f920a73df8097563e9 (diff)
downloadvcxsrv-392f542ca74be7b3721e7a4af75544a39e0eceae.tar.gz
vcxsrv-392f542ca74be7b3721e7a4af75544a39e0eceae.tar.bz2
vcxsrv-392f542ca74be7b3721e7a4af75544a39e0eceae.zip
Escaping of the $ sign by doubling it was not always done correctly.
Diffstat (limited to 'tools')
-rw-r--r--tools/mhmake/src/mhmakefileparser.cpp22
-rw-r--r--tools/mhmake/src/mhmakelexer.l2
-rw-r--r--tools/mhmake/src/util.cpp16
-rw-r--r--tools/mhmake/src/util.h2
4 files changed, 19 insertions, 23 deletions
diff --git a/tools/mhmake/src/mhmakefileparser.cpp b/tools/mhmake/src/mhmakefileparser.cpp
index 28ad0a682..cbcb33648 100644
--- a/tools/mhmake/src/mhmakefileparser.cpp
+++ b/tools/mhmake/src/mhmakefileparser.cpp
@@ -167,7 +167,7 @@ string mhmakefileparser::ExpandExpression(const string &Expr) const
int i=0;
int Length=Expr.size();
string Ret;
- bool DollarEscaped=false;
+ string ToAdd;
while (i<Length)
{
char Char=Expr[i++];
@@ -176,9 +176,8 @@ string mhmakefileparser::ExpandExpression(const string &Expr) const
char CharNext=Expr[i];
if (CharNext=='$')
{
- Ret+="$$";
+ ToAdd="$$";
i++;
- DollarEscaped=true;
}
else
{
@@ -186,34 +185,31 @@ string mhmakefileparser::ExpandExpression(const string &Expr) const
i++;
if (inew>i)
{
- Ret+=ExpandMacro(Expr.substr(i,inew-i-1));
+ ToAdd=ExpandMacro(Expr.substr(i,inew-i-1));
i=inew;
}
else
{
// This is a single character expression
- Ret+=ExpandMacro(string(1,Expr[i-1]));
+ ToAdd=ExpandMacro(string(1,Expr[i-1]));
}
}
+ Ret+=ToAdd;
}
else
{
Ret+=Char;
}
-
}
- // Here we do a special case in case we still have a $ without a %
if (m_InExpandExpression==1)
{
+ // Here we do a special case in case we still have a $ within a %
if (Ret.find('$')!=string::npos)
Ret=ExpandExpression(Ret);
- if (DollarEscaped)
+ int Pos;
+ while ((Pos=Ret.find("$$"))!=string::npos)
{
- int Pos;
- while ((Pos=Ret.find("$$"))!=string::npos)
- {
- Ret=Ret.replace(Pos,2,"$");
- }
+ Ret=Ret.replace(Pos,2,"$");
}
}
((mhmakefileparser*)this)->m_InExpandExpression--;
diff --git a/tools/mhmake/src/mhmakelexer.l b/tools/mhmake/src/mhmakelexer.l
index eb27ab9ed..b9484159a 100644
--- a/tools/mhmake/src/mhmakelexer.l
+++ b/tools/mhmake/src/mhmakelexer.l
@@ -672,7 +672,7 @@ export {
}
/*---------------------------------------------------------------------------*/
-\$[<@/] {
+\$[<@/$] {
PRINTF(("%s %d: DOLLAREXPR: %s\n",m_InputFileName.c_str(),m_Line,yytext));
theValue.theString=(const char *)yytext;
return mhmakeparser::DOLLAREXPR;
diff --git a/tools/mhmake/src/util.cpp b/tools/mhmake/src/util.cpp
index 824c94b4d..be0e92281 100644
--- a/tools/mhmake/src/util.cpp
+++ b/tools/mhmake/src/util.cpp
@@ -274,24 +274,24 @@ loadedmakefile::loadedmakefile_statics::loadedmakefile_statics()
string Output;
bool Ret;
try
- {
+ {
string SvnCommand=SearchCommand("svn",EXEEXT);
Ret=OsExeCommand(SvnCommand,string(" info ")+m_MhMakeConf->GetFullFileName(),false,&Output);
- }
+ }
catch (int)
- {
+ {
Ret=false;
- }
+ }
char *pTok=strtok((char*)Output.c_str(),"\n"); // doing this is changing string, so this is very dangerous !!!
while (pTok)
- {
+ {
if (!strncmp(pTok,"URL: ",5))
- {
+ {
m_GlobalCommandLineVars[WC_URL]=pTok+5+7;
- }
+ }
else if (!strncmp(pTok,"Revision: ",10))
- {
+ {
m_GlobalCommandLineVars[WC_REVISION]=pTok+10;
break;
}
diff --git a/tools/mhmake/src/util.h b/tools/mhmake/src/util.h
index 8d71e4ca5..6d660fc94 100644
--- a/tools/mhmake/src/util.h
+++ b/tools/mhmake/src/util.h
@@ -50,7 +50,7 @@
#define PLATFORM "linux"
#endif
-#define MHMAKEVER "1.3.21"
+#define MHMAKEVER "1.3.22"
#define MAKEDEPFILE ".makefile.dep"