From nobody Mon May 6 03:18:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599121496; cv=none; d=zohomail.com; s=zohoarc; b=lu8P7AlIAuP9r8khLZkOuBCanY6lZFTlZA3irrhZ2CtUVJk3b4v4bsbEd7aPosSgOPMPSWSNsP3b1D7C42Xi6uTxQmLsmkc8hsmeYbCHiOVT40xENXtiPUwjfw8EwXvBfoED9ZSrXEQwzZFnz47i3PrBqkKtLQQwLQGNOQSqhcI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599121496; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=d9dPfZq3OoVQwcPD139McMIHAGPBNwn6SG+6nAwVn3w=; b=M4Y3EDmerpdu9orS3aUS6/fQyDTrKZ+kBD1Bq7UPX1DEufkBZDDkcCyMDypy8ukp+MS8bMNuhXA6GVr73UOWdipw8187hFI6a0cmc/7H7R9vTIYpLbHAGjvfblbDYh+MFxC8qh/zy6l4buT/jDKS39iNwvvRgj2i4lhq2rQaG+Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 15991214969371021.0246655259095; Thu, 3 Sep 2020 01:24:56 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-127--2SbSvBmNCWOVb4Urk_BcQ-1; Thu, 03 Sep 2020 04:24:53 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B734A18BE166; Thu, 3 Sep 2020 08:24:47 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BFD5E19C59; Thu, 3 Sep 2020 08:24:45 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1C10F181A050; Thu, 3 Sep 2020 08:24:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0838Odgu018726 for ; Thu, 3 Sep 2020 04:24:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id EEE1219C71; Thu, 3 Sep 2020 08:24:39 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.193.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 706A319C59 for ; Thu, 3 Sep 2020 08:24:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599121496; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=d9dPfZq3OoVQwcPD139McMIHAGPBNwn6SG+6nAwVn3w=; b=AtZi8LnX+aDvAteNy4kx2/9KTH+Pi0SZV9k7D7i3S+L7OZ91rBYkwr/nSiuPLs+1VjXBcT 3TovJq73edWzFwx+tMAU2GzgGdCh5x0ML57x0WpFXD7tDr7tMPVlCzWK9DMcA7sZc1HHKd Jjy+jguS0xKENr0zNk9dANr3dVrx4G8= X-MC-Unique: -2SbSvBmNCWOVb4Urk_BcQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 1/2] vsh: Introduce wrapper for add_history() Date: Thu, 3 Sep 2020 10:24:33 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This allows us to drop include of readline header files from virsh.c and virt-admin.c because they needed it only because of the add_history() function. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- tools/virsh.c | 10 ++-------- tools/virt-admin.c | 10 ++-------- tools/vsh.c | 12 ++++++++++++ tools/vsh.h | 2 ++ 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index 06ff5e8336..ac9b7ad238 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -30,11 +30,6 @@ #include #include =20 -#if WITH_READLINE -# include -# include -#endif - #include "internal.h" #include "virerror.h" #include "virbuffer.h" @@ -920,9 +915,8 @@ main(int argc, char **argv) if (ctl->cmdstr =3D=3D NULL) break; /* EOF */ if (*ctl->cmdstr) { -#if WITH_READLINE - add_history(ctl->cmdstr); -#endif + vshReadlineHistoryAdd(ctl->cmdstr); + if (vshCommandStringParse(ctl, ctl->cmdstr, NULL)) vshCommandRun(ctl, ctl->cmd); } diff --git a/tools/virt-admin.c b/tools/virt-admin.c index 774661b2ca..72084a78e9 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -24,11 +24,6 @@ #include #include =20 -#if WITH_READLINE -# include -# include -#endif - #include "internal.h" #include "virt-admin.h" #include "viralloc.h" @@ -1597,9 +1592,8 @@ main(int argc, char **argv) if (ctl->cmdstr =3D=3D NULL) break; /* EOF */ if (*ctl->cmdstr) { -#if WITH_READLINE - add_history(ctl->cmdstr); -#endif + vshReadlineHistoryAdd(ctl->cmdstr); + if (vshCommandStringParse(ctl, ctl->cmdstr, NULL)) vshCommandRun(ctl, ctl->cmd); } diff --git a/tools/vsh.c b/tools/vsh.c index 11f493f969..2511089e6e 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -2925,6 +2925,12 @@ vshReadline(vshControl *ctl G_GNUC_UNUSED, const cha= r *prompt) return readline(prompt); } =20 +void +vshReadlineHistoryAdd(const char *cmd) +{ + return add_history(cmd); +} + #else /* !WITH_READLINE */ =20 static int @@ -2960,6 +2966,12 @@ vshReadline(vshControl *ctl G_GNUC_UNUSED, return g_strdup(r); } =20 +void +vshReadlineHistoryAdd(const char *cmd) +{ + /* empty */ +} + #endif /* !WITH_READLINE */ =20 /* diff --git a/tools/vsh.h b/tools/vsh.h index 290bb71f3e..0a40995bf5 100644 --- a/tools/vsh.h +++ b/tools/vsh.h @@ -463,6 +463,8 @@ bool cmdComplete(vshControl *ctl, const vshCmd *cmd); /* readline */ char * vshReadline(vshControl *ctl, const char *prompt); =20 +void vshReadlineHistoryAdd(const char *cmd); + /* allocation wrappers */ void *_vshMalloc(vshControl *ctl, size_t sz, const char *filename, int lin= e); #define vshMalloc(_ctl, _sz) _vshMalloc(_ctl, _sz, __FILE__, __LINE__) --=20 2.26.2 From nobody Mon May 6 03:18:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599121512; cv=none; d=zohomail.com; s=zohoarc; b=CE5+EhMW/yTSDHxsjXalGrOrCL8OtGgpH00Kh8Z4/6/a1KwlyRCvAobIYJElS7Kr7ljdJfNDJ4JX0aF+HvFoOzUyWvQGI5dqQX4iP1C6TsZMm8PPEHyGv71+L2FJt5InT2a36qDsoW2j0t2rn6slib4aHUzQ0z/Grf4zyZBjkUA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599121512; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=EiCxZfgTHPqdFplj5d4bHSbxZ+PJN5IyR2IOfqiqgBg=; b=YKhjG+MqZSuSJwoGHC/pOZRuyT1k3c67D31dvAkpFfJKk8eqUvSwB8Abw5LG+miiNUW7i4/xiExLMxdfvicVba0p262oKfFB1S7s6XGS3rnWiW5JmKvpCc0/x5SpwZeSn+bu6FskrK3JRelGHtny+PGGFF5ZYFmlQ1fF+boU+hk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1599121512252653.4279106941184; Thu, 3 Sep 2020 01:25:12 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-202-9k4GqpQSOkSOev3qqnPVIw-1; Thu, 03 Sep 2020 04:25:09 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CB14418BE167; Thu, 3 Sep 2020 08:25:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A96F276E01; Thu, 3 Sep 2020 08:25:03 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6C23A79DBA; Thu, 3 Sep 2020 08:25:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0838OeHb018737 for ; Thu, 3 Sep 2020 04:24:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id CB83E19C71; Thu, 3 Sep 2020 08:24:40 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.193.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4D46119C59 for ; Thu, 3 Sep 2020 08:24:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599121511; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=EiCxZfgTHPqdFplj5d4bHSbxZ+PJN5IyR2IOfqiqgBg=; b=a0umF4TvZXIWMbUioFR1W+GcGxh5sob0J2Wv5/cntxEO/5gKt4gP2wwzXDStRqGM8m/rmM igLExwqkpXIYlGngXT8HeeaVlyeWhW2bYdrTRgO/1yf/gTQJgXJLbtpw+E5xrpbz53J7zN zJYnj1tCfEj1GhlUqHTSgSayDnBcToM= X-MC-Unique: 9k4GqpQSOkSOev3qqnPVIw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 2/2] vsh: Define HAVE_STDARG_H before including readline Date: Thu, 3 Sep 2020 10:24:34 +0200 Message-Id: <6d5de1250f67b929d0baa43d09e87d3d0745a278.1599121323.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" As it turned out my previous commits which switched from HAVE_ to WITH_ and dropped stdarg.h detection were a bit too aggressive. Because of reasons described in 9ea3424a178 we need to define HAVE_STDARG_H before including readline otherwise macos build fails. Honestly, I still don't fully understand the problem so I am not going to bother you with "explanation". Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- tools/vsh.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/vsh.c b/tools/vsh.c index 2511089e6e..ef2a3f62d7 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -30,6 +30,10 @@ #include =20 #if WITH_READLINE +/* In order to have proper rl_message declaration with older + * versions of readline, we have to declare this. See 9ea3424a178 + * for more info. */ +# define HAVE_STDARG_H # include # include #endif --=20 2.26.2