All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH 1/5] support command string with space
@ 2009-09-30  0:28 Takahiro Yasui
  2009-09-30 20:24 ` Petr Rockai
  0 siblings, 1 reply; 6+ messages in thread
From: Takahiro Yasui @ 2009-09-30  0:28 UTC (permalink / raw)
  To: lvm-devel

Support escaped space by backslash in the command line string passed
through lvm2 command interface, lvm2_run(). This is used to handle
"--config" option which contains multiple parameters.

e.g. lvconvert --repair --use-policies --config \
     devices{ignore_suspended_devices=1\ filter=[...]} vg/lv


Signed-off-by: Takahiro Yasui <tyasui@redhat.com>
---
 tools/lvmcmdline.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Index: LVM2.02.54-20090928/tools/lvmcmdline.c
===================================================================
--- LVM2.02.54-20090928.orig/tools/lvmcmdline.c
+++ LVM2.02.54-20090928/tools/lvmcmdline.c
@@ -1070,8 +1070,15 @@ int lvm_split(char *str, int *argc, char
 			break;
 
 		e = b;
-		while (*e && !isspace(*e))
+		while (*e && !isspace(*e)) {
+			/*
+			 * 'backslash' is treated as a escape character
+			 * and the string isn't split at 'backslash + space.'
+			 */
+			if (*e == '\\' && isspace(*(e+1)))
+				*e++ = ' ';
 			e++;
+		}
 
 		argv[(*argc)++] = b;
 		if (!*e)

-- 
Takahiro Yasui
Hitachi Computer Products (America), Inc.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-10-16 19:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-30  0:28 [RFC][PATCH 1/5] support command string with space Takahiro Yasui
2009-09-30 20:24 ` Petr Rockai
2009-09-30 21:19   ` Takahiro Yasui
2009-10-01  5:54     ` Petr Rockai
2009-10-16 19:00       ` Takahiro Yasui
2009-10-06 11:47   ` Alasdair G Kergon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.