[cmake-commits] king committed System.c 1.10 1.11 System.h.in 1.6 1.7

cmake-commits at cmake.org cmake-commits at cmake.org
Sun Jan 13 16:36:22 EST 2008


Update of /cvsroot/CMake/CMake/Source/kwsys
In directory public:/mounts/ram/cvs-serv22089/Source/kwsys

Modified Files:
	System.c System.h.in 
Log Message:
ENH: Improved escaping in kwsys/System.  Added escape of % for NMake.  Added escape of ; for the VS IDE.


Index: System.h.in
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/System.h.in,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- System.h.in	17 May 2007 14:53:14 -0000	1.6
+++ System.h.in	13 Jan 2008 21:36:20 -0000	1.7
@@ -34,6 +34,7 @@
 #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_NMake                 kwsys_ns(System_Shell_Flag_NMake)
 #define kwsysSystem_Shell_Flag_AllowMakeVariables    kwsys_ns(System_Shell_Flag_AllowMakeVariables)
 
 #if defined(__cplusplus)
@@ -90,6 +91,9 @@
   /** The target shell is in a MinGW Make makefile.  */
   kwsysSystem_Shell_Flag_MinGWMake          = (1<<4),
 
+  /** The target shell is in a NMake makefile.  */
+  kwsysSystem_Shell_Flag_NMake              = (1<<6),
+
   /** 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
@@ -117,6 +121,7 @@
 # undef kwsysSystem_Shell_Flag_EchoWindows
 # undef kwsysSystem_Shell_Flag_WatcomWMake
 # undef kwsysSystem_Shell_Flag_MinGWMake
+# undef kwsysSystem_Shell_Flag_NMake
 # undef kwsysSystem_Shell_Flag_AllowMakeVariables
 #endif
 

Index: System.c
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/System.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- System.c	18 May 2007 13:17:36 -0000	1.10
+++ System.c	13 Jan 2008 21:36:20 -0000	1.11
@@ -315,13 +315,23 @@
       {
       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 @@
       {
       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 @@
         *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.  */



More information about the Cmake-commits mailing list