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

Re: [libvirt] [PATCH 7/8] virsh: support single quote



On 10/12/2010 01:14 AM, Lai Jiangshan wrote:
Some use may type command like this at the virsh shell:
virsh # somecmd 'some arg'

because some users often use single quote in linux shell.

Signed-off-by: Lai Jiangshan<laijs cn fujitsu com>
---
diff --git a/tools/virsh.c b/tools/virsh.c
index b96071d..a5b438b 100644

Tests would be nice. I'll see about adding some in another patch, probably by adding a 'virsh echo ...' command that echoes its arguments for reuse.

+        if (!double_quote&&  !single_quote
+&&  (*p == ' ' || *p == '\t' || *p == ';'))

Convention on this project is to line break after operators rather than before. It's not a hard-fast rule, but as long as I'm on a roll of tweaking every one of your patches... :) [And pardon Thunderbird's stupid bug that mangles the spacing before any word beginning with &, <, or > in the quoted portions of my message.]

ACK with this squashed in:

diff --git i/tools/virsh.c w/tools/virsh.c
index c38f91d..e21bbf2 100644
--- i/tools/virsh.c
+++ w/tools/virsh.c
@@ -10257,8 +10257,8 @@ vshCommandStringGetArg(vshControl *ctl, vshCommandParser *parser, char **res)

     while (*p) {
         /* end of token is blank space or ';' */
-        if (!double_quote && !single_quote
-                && (*p == ' ' || *p == '\t' || *p == ';'))
+        if (!double_quote && !single_quote &&
+            (*p == ' ' || *p == '\t' || *p == ';'))
             break;

         if (!double_quote && *p == '\'') { /* single quote */

--
Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


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