From 7e88b4e98840cb1e963f6776c659851137e5035c Mon Sep 17 00:00:00 2001
From: Christophe CURIS <[email protected]>
Date: Wed, 18 Jul 2012 00:19:55 +0200
Subject: [PATCH 3/3] Menu parser: remove d-quotes around title of entry

When a menu entry contains a space, it is necessary to enclose it
in simple or double quotes; these were not removed and so would
appear in the menu.
---
 WINGs/menuparser.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/WINGs/menuparser.c b/WINGs/menuparser.c
index 881c4e8..97c6728 100644
--- a/WINGs/menuparser.c
+++ b/WINGs/menuparser.c
@@ -222,6 +222,21 @@ Bool WMenuParserGetLine(WMenuParser top_parser, char **title, char **command, ch
 		}
 	}
 
+	if (title != NULL) {
+		char eot, *src, *dst;
+
+		src = *title;
+		eot = *src++;
+		if ((eot == '"') || (eot == '\'')) {
+			dst = *title;
+			while (*src != '\0')
+				*dst++ = *src++;
+			if ((dst > *title) && (dst[-1] == eot))
+				dst--;
+			*dst = '\0';
+		}
+	}
+
 	if (params != NULL) {
 		lineparam[sizeof(lineparam) - 1] = '\0';
 		*parameter = wstrdup(lineparam);
-- 
1.7.10.4

Reply via email to