[PATCH 6/8] virsh: add escaper \ for command string parsing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



add escaper \ for command string parsing, example:

virsh # cd /path/which/have/a/double\"quote

Signed-off-by: Lai Jiangshan <laijs@xxxxxxxxxxxxxx>
---
diff --git a/tools/virsh.c b/tools/virsh.c
index 9fd0602..b96071d 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -10235,7 +10235,11 @@ copy:
         if (!double_quote && (*p == ' ' || *p == '\t' || *p == ';'))
             break;
 
-	if (*p == '"') {
+        if (*p == '\\') { /* escape */
+            p++;
+            if (*p == '\0')
+                break;
+        } else if (*p == '"') { /* double quote */
             double_quote = !double_quote;
             p++;
             continue;

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]