summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-04-04 15:38:01 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-04-04 15:38:01 (GMT)
commit84487e91597c9a07e877251d09aa075133327088 (patch)
tree345915fa334ac9555de1fff1ec6331a8b44d3c46 /Source
parent4a227d280bdd08f5380274292e8cf8c06c2ed3fd (diff)
parent23b4abb26082fbaec523ad48f4be54f55c11b58c (diff)
downloadCMake-84487e91597c9a07e877251d09aa075133327088.zip
CMake-84487e91597c9a07e877251d09aa075133327088.tar.gz
CMake-84487e91597c9a07e877251d09aa075133327088.tar.bz2
Merge topic 'update-kwsys'
23b4abb2 Merge branch 'upstream-kwsys' into update-kwsys eccc425a KWSys 2014-04-02 (39f98b5d)
Diffstat (limited to 'Source')
-rw-r--r--Source/kwsys/EncodingCXX.cxx19
-rw-r--r--Source/kwsys/System.c30
-rw-r--r--Source/kwsys/System.h.in9
3 files changed, 46 insertions, 12 deletions
diff --git a/Source/kwsys/EncodingCXX.cxx b/Source/kwsys/EncodingCXX.cxx
index f76deb5..251a56d 100644
--- a/Source/kwsys/EncodingCXX.cxx
+++ b/Source/kwsys/EncodingCXX.cxx
@@ -110,16 +110,19 @@ Encoding::CommandLineArguments::
Encoding::CommandLineArguments&
Encoding::CommandLineArguments::operator=(const CommandLineArguments& other)
{
- size_t i;
- for(i=0; i<this->argv_.size(); i++)
+ if(this != &other)
{
- free(this->argv_[i]);
- }
+ size_t i;
+ for(i=0; i<this->argv_.size(); i++)
+ {
+ free(this->argv_[i]);
+ }
- this->argv_.resize(other.argv_.size());
- for(i=0; i<this->argv_.size(); i++)
- {
- this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : 0;
+ this->argv_.resize(other.argv_.size());
+ for(i=0; i<this->argv_.size(); i++)
+ {
+ this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : 0;
+ }
}
return *this;
diff --git a/Source/kwsys/System.c b/Source/kwsys/System.c
index 5d178bf..1ee26fa 100644
--- a/Source/kwsys/System.c
+++ b/Source/kwsys/System.c
@@ -353,6 +353,10 @@ static int kwsysSystem_Shell__GetArgumentSize(const char* in,
if(kwsysSystem_Shell__ArgumentNeedsQuotes(in, isUnix, flags))
{
/* Surrounding quotes are needed. Allocate space for them. */
+ if((flags & kwsysSystem_Shell_Flag_WatcomQuote) && (isUnix))
+ {
+ size += 2;
+ }
size += 2;
/* We must escape all ending backslashes when quoting on windows. */
@@ -377,7 +381,18 @@ static char* kwsysSystem_Shell__GetArgument(const char* in, char* out,
if(needQuotes)
{
/* Add the opening quote for this argument. */
- *out++ = '"';
+ if(flags & kwsysSystem_Shell_Flag_WatcomQuote)
+ {
+ if(isUnix)
+ {
+ *out++ = '"';
+ }
+ *out++ = '\'';
+ }
+ else
+ {
+ *out++ = '"';
+ }
}
/* Scan the string for characters that require escaping or quoting. */
@@ -549,7 +564,18 @@ static char* kwsysSystem_Shell__GetArgument(const char* in, char* out,
}
/* Add the closing quote for this argument. */
- *out++ = '"';
+ if(flags & kwsysSystem_Shell_Flag_WatcomQuote)
+ {
+ *out++ = '\'';
+ if(isUnix)
+ {
+ *out++ = '"';
+ }
+ }
+ else
+ {
+ *out++ = '"';
+ }
}
/* Store a terminating null without incrementing. */
diff --git a/Source/kwsys/System.h.in b/Source/kwsys/System.h.in
index 549db90..f21bf0d 100644
--- a/Source/kwsys/System.h.in
+++ b/Source/kwsys/System.h.in
@@ -36,6 +36,7 @@
# define kwsysSystem_Shell_Flag_MinGWMake kwsys_ns(System_Shell_Flag_MinGWMake)
# define kwsysSystem_Shell_Flag_NMake kwsys_ns(System_Shell_Flag_NMake)
# define kwsysSystem_Shell_Flag_AllowMakeVariables kwsys_ns(System_Shell_Flag_AllowMakeVariables)
+# define kwsysSystem_Shell_Flag_WatcomQuote kwsys_ns(System_Shell_Flag_WatcomQuote)
#endif
#ifdef __VMS
@@ -102,14 +103,17 @@ enum kwsysSystem_Shell_Flag_e
kwsysSystem_Shell_Flag_MinGWMake = (1<<4),
/** The target shell is in a NMake makefile. */
- kwsysSystem_Shell_Flag_NMake = (1<<6),
+ kwsysSystem_Shell_Flag_NMake = (1<<5),
/** 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<<5)
+ kwsysSystem_Shell_Flag_AllowMakeVariables = (1<<6),
+
+ /** The target shell quoting uses extra single Quotes for Watcom tools. */
+ kwsysSystem_Shell_Flag_WatcomQuote = (1<<7)
};
/**
@@ -156,6 +160,7 @@ kwsysEXPORT char** kwsysSystem_Parse_CommandForUnix(const char* command,
# undef kwsysSystem_Shell_Flag_MinGWMake
# undef kwsysSystem_Shell_Flag_NMake
# undef kwsysSystem_Shell_Flag_AllowMakeVariables
+# undef kwsysSystem_Shell_Flag_WatcomQuote
# endif
#endif