[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4945092.GXAFRqVoOG@devpool47.emlix.com>
Date: Thu, 19 Dec 2024 08:21:23 +0100
From: Rolf Eike Beer <eb@...ix.com>
To: Masahiro Yamada <masahiroy@...nel.org>
Cc: linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 2/4] kconfig: qconf: use QCommandLineParser
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 <eb@...ix.com>
---
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 <QActionGroup>
#include <QApplication>
#include <QCloseEvent>
+#include <QCommandLineParser>
#include <QDebug>
#include <QFileDialog>
#include <QLabel>
@@ -1785,41 +1786,30 @@ void fixup_rootmenu(struct menu *menu)
}
}
-static const char *progname;
-
-static void usage(void)
-{
- printf("%s [-s] <config>\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();
--
2.47.1
--
Rolf Eike Beer
emlix GmbH
Headquarters: Berliner Str. 12, 37073 Göttingen, Germany
Phone +49 (0)551 30664-0, e-mail info@...ix.com
District Court of Göttingen, Registry Number HR B 3160
Managing Directors: Heike Jordan, Dr. Uwe Kracke
VAT ID No. DE 205 198 055
Office Berlin: Panoramastr. 1, 10178 Berlin, Germany
Office Bonn: Bachstr. 6, 53115 Bonn, Germany
http://www.emlix.com
emlix - your embedded Linux partner
Powered by blists - more mailing lists