summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/System.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-04-30 19:58:45 (GMT)
committerBrad King <brad.king@kitware.com>2008-04-30 19:58:45 (GMT)
commit16ec04c2a7ed80fc10cbc731ef3f7646b5fe6b1a (patch)
tree468ed480667295bd18694cabe05b70af42d37601 /Source/kwsys/System.c
parent637596a157bba8a18ee51ca0c7dc27df278c8596 (diff)
downloadCMake-16ec04c2a7ed80fc10cbc731ef3f7646b5fe6b1a.zip
CMake-16ec04c2a7ed80fc10cbc731ef3f7646b5fe6b1a.tar.gz
CMake-16ec04c2a7ed80fc10cbc731ef3f7646b5fe6b1a.tar.bz2
BUG: Fix escaping of more characters on Windows shells.
Diffstat (limited to 'Source/kwsys/System.c')
-rw-r--r--Source/kwsys/System.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/Source/kwsys/System.c b/Source/kwsys/System.c
index 3908c05..d205c96 100644
--- a/Source/kwsys/System.c
+++ b/Source/kwsys/System.c
@@ -75,6 +75,13 @@ static int kwsysSystem_Shell__CharNeedsQuotesOnUnix(char c)
}
/*--------------------------------------------------------------------------*/
+static int kwsysSystem_Shell__CharNeedsQuotesOnWindows(char c)
+{
+ return ((c == '\'') || (c == '#') || (c == '&') ||
+ (c == '<') || (c == '>') || (c == '|') || (c == '^'));
+}
+
+/*--------------------------------------------------------------------------*/
static int kwsysSystem_Shell__CharNeedsQuotes(char c, int isUnix, int flags)
{
/* On Windows the built-in command shell echo never needs quotes. */
@@ -99,14 +106,10 @@ static int kwsysSystem_Shell__CharNeedsQuotes(char c, int isUnix, int flags)
}
else
{
- /* On Windows single-quotes must be escaped in some make
- environments, such as in mingw32-make. */
- if(flags & kwsysSystem_Shell_Flag_Make)
+ /* On Windows several special characters need quotes to preserve them. */
+ if(kwsysSystem_Shell__CharNeedsQuotesOnWindows(c))
{
- if(c == '\'')
- {
- return 1;
- }
+ return 1;
}
}
return 0;