mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-08 07:10:12 -05:00
ENH: Improved escaping in kwsys/System. Added escape of % for NMake. Added escape of ; for the VS IDE.
This commit is contained in:
+35
-5
@@ -315,13 +315,23 @@ static int kwsysSystem_Shell__GetArgumentSize(const char* in,
|
||||
{
|
||||
if((flags & kwsysSystem_Shell_Flag_VSIDE) ||
|
||||
((flags & kwsysSystem_Shell_Flag_Make) &&
|
||||
(flags & kwsysSystem_Shell_Flag_MinGWMake)))
|
||||
((flags & kwsysSystem_Shell_Flag_MinGWMake) ||
|
||||
(flags & kwsysSystem_Shell_Flag_NMake))))
|
||||
{
|
||||
/* In the VS IDE or MinGW make a percent is written %% so we
|
||||
need one extra characters. */
|
||||
/* In the VS IDE, NMake, or MinGW make a percent is written %%
|
||||
so we need one extra characters. */
|
||||
size += 1;
|
||||
}
|
||||
}
|
||||
else if(*c == ';')
|
||||
{
|
||||
if(flags & kwsysSystem_Shell_Flag_VSIDE)
|
||||
{
|
||||
/* In a VS IDE a semicolon is written ";" so we need two extra
|
||||
characters. */
|
||||
size += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Check whether the argument needs surrounding quotes. */
|
||||
@@ -471,9 +481,10 @@ static char* kwsysSystem_Shell__GetArgument(const char* in, char* out,
|
||||
{
|
||||
if((flags & kwsysSystem_Shell_Flag_VSIDE) ||
|
||||
((flags & kwsysSystem_Shell_Flag_Make) &&
|
||||
(flags & kwsysSystem_Shell_Flag_MinGWMake)))
|
||||
((flags & kwsysSystem_Shell_Flag_MinGWMake) ||
|
||||
(flags & kwsysSystem_Shell_Flag_NMake))))
|
||||
{
|
||||
/* In the VS IDE or MinGW make a percent is written %%. */
|
||||
/* In the VS IDE, NMake, or MinGW make a percent is written %%. */
|
||||
*out++ = '%';
|
||||
*out++ = '%';
|
||||
}
|
||||
@@ -483,6 +494,25 @@ static char* kwsysSystem_Shell__GetArgument(const char* in, char* out,
|
||||
*out++ = '%';
|
||||
}
|
||||
}
|
||||
else if(*c == ';')
|
||||
{
|
||||
if(flags & kwsysSystem_Shell_Flag_VSIDE)
|
||||
{
|
||||
/* In a VS IDE a semicolon is written ";". If this is written
|
||||
in an un-quoted argument it starts a quoted segment,
|
||||
inserts the ; and ends the segment. If it is written in a
|
||||
quoted argument it ends quoting, inserts the ; and restarts
|
||||
quoting. Either way the ; is isolated. */
|
||||
*out++ = '"';
|
||||
*out++ = ';';
|
||||
*out++ = '"';
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Otherwise a semicolon is written just ;. */
|
||||
*out++ = ';';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Store this character. */
|
||||
|
||||
Reference in New Issue
Block a user