summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2007-05-17 14:53:14 (GMT)
committerBrad King <brad.king@kitware.com>2007-05-17 14:53:14 (GMT)
commitcc507411d3641297ed9fff7789cd4121dbe849b3 (patch)
tree007fb7d613ad4a4666ccb7d50290bce94cf12826
parent871f7cf2220906169bf1f7aebdf508c2e57ba2e1 (diff)
downloadCMake-cc507411d3641297ed9fff7789cd4121dbe849b3.zip
CMake-cc507411d3641297ed9fff7789cd4121dbe849b3.tar.gz
CMake-cc507411d3641297ed9fff7789cd4121dbe849b3.tar.bz2
ENH: Added more special unix shell characters that require quoting. Added escaping of % as %% for shells inside mingw32-make.
-rw-r--r--Source/kwsys/System.c18
-rw-r--r--Source/kwsys/System.h.in7
2 files changed, 18 insertions, 7 deletions
diff --git a/Source/kwsys/System.c b/Source/kwsys/System.c
index 41d6667..0446b79 100644
--- a/Source/kwsys/System.c
+++ b/Source/kwsys/System.c
@@ -60,7 +60,9 @@ static int kwsysSystem_Shell__CharIsWhitespace(char c)
static int kwsysSystem_Shell__CharNeedsQuotesOnUnix(char c)
{
return ((c == '\'') || (c == '`') || (c == ';') || (c == '#') ||
- (c == '&') || (c == '$') || (c == '(') || (c == ')'));
+ (c == '&') || (c == '$') || (c == '(') || (c == ')') ||
+ (c == '~') || (c == '<') || (c == '>') || (c == '|') ||
+ (c == '*') || (c == '\\'));
}
/*--------------------------------------------------------------------------*/
@@ -289,10 +291,12 @@ static int kwsysSystem_Shell__GetArgumentSize(const char* in,
}
else if(*c == '%')
{
- if(flags & kwsysSystem_Shell_Flag_VSIDE)
+ if((flags & kwsysSystem_Shell_Flag_VSIDE) ||
+ ((flags & kwsysSystem_Shell_Flag_Make) &&
+ (flags & kwsysSystem_Shell_Flag_MinGWMake)))
{
- /* In a VS IDE a percent is written %% so we need one extra
- characters. */
+ /* In the VS IDE or MinGW make a percent is written %% so we
+ need one extra characters. */
size += 1;
}
}
@@ -443,9 +447,11 @@ static char* kwsysSystem_Shell__GetArgument(const char* in, char* out,
}
else if(*c == '%')
{
- if(flags & kwsysSystem_Shell_Flag_VSIDE)
+ if((flags & kwsysSystem_Shell_Flag_VSIDE) ||
+ ((flags & kwsysSystem_Shell_Flag_Make) &&
+ (flags & kwsysSystem_Shell_Flag_MinGWMake)))
{
- /* In a VS IDE a percent is written %%. */
+ /* In the VS IDE or MinGW make a percent is written %%. */
*out++ = '%';
*out++ = '%';
}
diff --git a/Source/kwsys/System.h.in b/Source/kwsys/System.h.in
index 95a454c..b190262 100644
--- a/Source/kwsys/System.h.in
+++ b/Source/kwsys/System.h.in
@@ -33,6 +33,7 @@
#define kwsysSystem_Shell_Flag_VSIDE kwsys_ns(System_Shell_Flag_VSIDE)
#define kwsysSystem_Shell_Flag_EchoWindows kwsys_ns(System_Shell_Flag_EchoWindows)
#define kwsysSystem_Shell_Flag_WatcomWMake kwsys_ns(System_Shell_Flag_WatcomWMake)
+#define kwsysSystem_Shell_Flag_MinGWMake kwsys_ns(System_Shell_Flag_MinGWMake)
#define kwsysSystem_Shell_Flag_AllowMakeVariables kwsys_ns(System_Shell_Flag_AllowMakeVariables)
#if defined(__cplusplus)
@@ -86,12 +87,15 @@ enum kwsysSystem_Shell_Flag_e
/** The target shell is in a Watcom WMake makefile. */
kwsysSystem_Shell_Flag_WatcomWMake = (1<<3),
+ /** The target shell is in a MinGW Make makefile. */
+ kwsysSystem_Shell_Flag_MinGWMake = (1<<4),
+
/** Make variable reference syntax $(MAKEVAR) should not be escaped
to allow a build tool to replace it. Replacement values
containing spaces, quotes, backslashes, or other
non-alphanumeric characters that have significance to some makes
or shells produce undefined behavior. */
- kwsysSystem_Shell_Flag_AllowMakeVariables = (1<<4)
+ kwsysSystem_Shell_Flag_AllowMakeVariables = (1<<5)
};
#if defined(__cplusplus)
@@ -112,6 +116,7 @@ enum kwsysSystem_Shell_Flag_e
# undef kwsysSystem_Shell_Flag_VSIDE
# undef kwsysSystem_Shell_Flag_EchoWindows
# undef kwsysSystem_Shell_Flag_WatcomWMake
+# undef kwsysSystem_Shell_Flag_MinGWMake
# undef kwsysSystem_Shell_Flag_AllowMakeVariables
#endif