From patchwork Thu Dec 19 07:21:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rolf Eike Beer X-Patchwork-Id: 13914552 Received: from mx1.emlix.com (mx1.emlix.com [178.63.209.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 086301FBEB3; Thu, 19 Dec 2024 07:23:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.63.209.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734593015; cv=none; b=oJwzJqG8JF9efq3SZZ/QGYQjym/fRvkM3waPhrBk6Ej6HD5BPHEHexnvoQA5Ehx8BpTdttr/ndRd8LavMUxQhscW66tRzYOABmeL6/Q2Wh8jaAwDjX1n4PTsN9RyozzNDGLRbDyMKszH6eEOp4HmRgZOSUAyFsG8o5E6/w17xeE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734593015; c=relaxed/simple; bh=Okk8sxzKQlf7/XbtE8NF8dwpXdcmq0j5uX4X58f9c4M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IXzFLKQ/zA74tS4a98Uz+Wn9hbERDjPOsyFKOQJdvVtsbr6xfjQyV1O/f59rtC9c0zgsXlgl91Bf3l5HyG87u9hy6SMllM7Ox5knns2rnvNnRzGmG+RouYhB7GJQ9GjoYgBkTdF4twu9OHHkMrhQSycnDUDiBRbjrAcuqIp4xY4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=emlix.com; spf=pass smtp.mailfrom=emlix.com; arc=none smtp.client-ip=178.63.209.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=emlix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=emlix.com Received: from mailer.emlix.com (p5098be52.dip0.t-ipconnect.de [80.152.190.82]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.emlix.com (Postfix) with ESMTPS id A90CE5FA41; Thu, 19 Dec 2024 08:23:11 +0100 (CET) From: Rolf Eike Beer To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] kconfig: qconf: use QCommandLineParser Date: Thu, 19 Dec 2024 08:21:23 +0100 Message-ID: <4945092.GXAFRqVoOG@devpool47.emlix.com> Organization: emlix GmbH In-Reply-To: <5843611.DvuYhMxLoT@devpool47.emlix.com> References: <5843611.DvuYhMxLoT@devpool47.emlix.com> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This has a much nicer output without manual processing. It also adds window management options from Qt for free. Signed-off-by: Rolf Eike Beer --- scripts/kconfig/qconf.cc | 44 ++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index eaa465b0ccf9..4d500cc9ba9d 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -1785,41 +1786,30 @@ void fixup_rootmenu(struct menu *menu) } } -static const char *progname; - -static void usage(void) -{ - printf("%s [-s] \n", progname); - exit(0); -} - int main(int ac, char** av) { ConfigMainWindow* v; - const char *name; + configApp = new QApplication(ac, av); + QCommandLineParser cmdline; + QCommandLineOption silent("s", "silent"); - progname = av[0]; - if (ac > 1 && av[1][0] == '-') { - switch (av[1][1]) { - case 's': - conf_set_message_callback(NULL); - break; - case 'h': - case '?': - usage(); - } - name = av[2]; - } else - name = av[1]; - if (!name) - usage(); + cmdline.addOption(silent); + cmdline.addHelpOption(); + cmdline.addPositionalArgument("Kconfig", "Top-level Kconfig file", "Kconfig"); + + cmdline.process(*configApp); + + if (cmdline.isSet(silent)) + conf_set_message_callback(NULL); - conf_parse(name); + QStringList args = cmdline.positionalArguments(); + if (args.isEmpty()) + cmdline.showHelp(1); + + conf_parse(args.first().toLocal8Bit().constData()); fixup_rootmenu(&rootmenu); //zconfdump(stdout); - configApp = new QApplication(ac, av); - configSettings = new ConfigSettings(); configSettings->beginGroup("/kconfig/qconf"); v = new ConfigMainWindow();