From nobody Mon Feb 9 09:52:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1616429425; cv=none; d=zohomail.com; s=zohoarc; b=bJujeSvz58Dn62i1dtgqamHYzw8NgTqPS3ipbeLPT+Qm3hYO9JZhdbSXwXw62jvZdca3h/mSyuAqy02BBX2eWKBkQqyUYLgzUBLRzL86AFkvWN79p1UjyqNKfFJdgBAuv9TsRX4bhpI6xP/w1MbjWVSbYcHftfmIPS2S2+KRets= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616429425; h=Content-Type:Content-Transfer-Encoding:Cc: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=NWireD3W+eaNCFphYxAJHzfK24K66X3IvbklDA+/28Y=; b=ng5Yqkw1RHihjdNQ4x/TDqPaFsgoN2Otg6Pd8n/A4OzTbXlVG8yIFTIo670Y6mmolgNEgoPANUAgWoN9V1o7sRvfJxys/b4AU5of9fpxq9tx7A+WW+yL68F3RWXCys1cqfK6dZdTQZnQ0/lNpibYrWaC0WtEPXLQrhZY4i5BpbU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1616429425693325.1374578961776; Mon, 22 Mar 2021 09:10:25 -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-490-y0oz_1svNnyFxbXOkroSHw-1; Mon, 22 Mar 2021 12:10:22 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 774C6107ACCD; Mon, 22 Mar 2021 16:10:16 +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 EE5B91042B4C; Mon, 22 Mar 2021 16:10:15 +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 8EF291800216; Mon, 22 Mar 2021 16:10:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12MGAEMW010526 for ; Mon, 22 Mar 2021 12:10:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4B21E19CBA; Mon, 22 Mar 2021 16:10:14 +0000 (UTC) Received: from work.redhat.com (ovpn-112-246.ams2.redhat.com [10.36.112.246]) by smtp.corp.redhat.com (Postfix) with ESMTP id 89EC52DACE; Mon, 22 Mar 2021 16:10:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616429424; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=NWireD3W+eaNCFphYxAJHzfK24K66X3IvbklDA+/28Y=; b=gFVmxKVLS4tYtMcEzD4/EqF9ka9lOfVib/2S7KWT1j9zEAWyOeepaqChs3S0Euz4In6oyY EwWxf7Y9sv9hoz5SbuplWCDToPkgILLXRWgUUtZs1cdCyVbEJWFgH3wn2FJdHgN/pw4BrZ biivhJqekStXH3C3/ZJrIGBkFylZS0g= X-MC-Unique: y0oz_1svNnyFxbXOkroSHw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 2/5] vsh: Introduce flag for deprecated options Date: Mon, 22 Mar 2021 17:10:01 +0100 Message-Id: <20210322161004.145555-3-twiederh@redhat.com> In-Reply-To: <20210322161004.145555-1-twiederh@redhat.com> References: <20210322161004.145555-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake --- tools/vsh.c | 11 +++++++++-- tools/vsh.h | 9 +++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index 8fb033249e..8b58db8896 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -321,7 +321,8 @@ vshCmddefCheckInternals(vshControl *ctl, char *name =3D (char *)opt->help; /* cast away const */ char *p; =20 - if (opt->flags || !opt->help) { + if ((opt->flags !=3D 0 && opt->flags !=3D VSH_OFLAG_DEPRECATED= ) || + !opt->help) { vshError(ctl, _("parameter '%s' of command '%s' has incorr= ect alias option"), opt->name, cmd->name); return -1; /* alias options are tracked by the original na= me */ @@ -442,6 +443,11 @@ vshCmddefGetOption(vshControl *ctl, const vshCmdDef *c= md, const char *name, const vshCmdOptDef *opt =3D &cmd->opts[i]; =20 if (STREQ(opt->name, name)) { + if (report && (opt->flags & VSH_OFLAG_DEPRECATED)) { + vshDebug(ctl, VSH_ERR_WARNING, + _("Warning: Option '%s' is deprecated\n"), name); + } + if (opt->type =3D=3D VSH_OT_ALIAS) { char *value; =20 @@ -697,7 +703,8 @@ vshCmddefHelp(const vshCmdDef *def) continue; } =20 - fprintf(stdout, " %-15s %s\n", buf, _(opt->help)); + fprintf(stdout, " %-15s %s%s\n", buf, _(opt->help), + opt->flags & VSH_OFLAG_DEPRECATED ? " (deprecated)" : = ""); } } fputc('\n', stdout); diff --git a/tools/vsh.h b/tools/vsh.h index e83e0eca9e..e85206b726 100644 --- a/tools/vsh.h +++ b/tools/vsh.h @@ -98,10 +98,11 @@ typedef enum { * Command Option Flags */ enum { - VSH_OFLAG_NONE =3D 0, /* without flags */ - VSH_OFLAG_REQ =3D (1 << 0), /* option required */ - VSH_OFLAG_EMPTY_OK =3D (1 << 1), /* empty string option allowed */ - VSH_OFLAG_REQ_OPT =3D (1 << 2), /* --optionname required */ + VSH_OFLAG_NONE =3D 0, /* without flags */ + VSH_OFLAG_REQ =3D (1 << 0), /* option required */ + VSH_OFLAG_EMPTY_OK =3D (1 << 1), /* empty string option allowed */ + VSH_OFLAG_REQ_OPT =3D (1 << 2), /* --optionname required */ + VSH_OFLAG_DEPRECATED =3D (1 << 3), /* option is deprecated */ }; =20 /* forward declarations */ --=20 2.26.2