From 7f5573e880bbb759d6444d4c29884ee07b197c17 Mon Sep 17 00:00:00 2001
From: Brad King <brad.king@kitware.com>
Date: Thu, 18 Dec 2008 13:36:58 -0500
Subject: [PATCH] BUG: Fix windows command line escape for empty arg

On Windows the KWSys System package generates escapes for command-line
arguments.  This fix enables quoting of the empty string as an argument.
This also adds a test to pass an empty argument to a custom command.
---
 System.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/System.c b/System.c
index 2ff820e..2208361 100644
--- a/System.c
+++ b/System.c
@@ -170,6 +170,12 @@ flag later when we understand applications of this better.
 static int kwsysSystem_Shell__ArgumentNeedsQuotes(const char* in, int isUnix,
                                                   int flags)
 {
+  /* The empty string needs quotes.  */
+  if(!*in)
+    {
+    return 1;
+    }
+
   /* Scan the string for characters that require quoting.  */
   {
   const char* c;
-- 
GitLab