[lvm-devel] [RFC][PATCH 1/5] support command string with space
Takahiro Yasui
tyasui at redhat.com
Wed Sep 30 00:28:09 UTC 2009
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 at 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.
More information about the lvm-devel
mailing list