summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2019-11-13 13:42:11 +1000
committerRan Benita <ran234@gmail.com>2019-11-18 15:32:35 +0200
commit1de2f174c2dceefeff6886f84c0a6b658c3665f0 (patch)
tree2d4499bdb84672455c7244f4adc924f705245f76 /test
parent7c42945e04a2107827a057245298dedc0475cc88 (diff)
downloadxorg-lib-libxkbcommon-1de2f174c2dceefeff6886f84c0a6b658c3665f0.tar.gz
test: let rmlvo-to-kccgst take long options like rmlvo-to-keymap
The short options were left for backwards compatibility. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'test')
-rw-r--r--test/rmlvo-to-kccgst.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/test/rmlvo-to-kccgst.c b/test/rmlvo-to-kccgst.c
index f3c8076..99e5064 100644
--- a/test/rmlvo-to-kccgst.c
+++ b/test/rmlvo-to-kccgst.c
@@ -22,6 +22,7 @@
*/
#include <unistd.h>
+#include <getopt.h>
#include "test.h"
#include "xkbcomp/xkbcomp-priv.h"
@@ -30,13 +31,29 @@
int
main(int argc, char *argv[])
{
- int opt;
struct xkb_rule_names rmlvo = { NULL };
struct xkb_context *ctx;
struct xkb_component_names kccgst;
- while ((opt = getopt(argc, argv, "r:m:l:v:o:h")) != -1) {
- switch (opt) {
+ static struct option opts[] = {
+ {"help", no_argument, 0, 'h'},
+ {"rules", required_argument, 0, 'r'},
+ {"model", required_argument, 0, 'm'},
+ {"layout", required_argument, 0, 'l'},
+ {"variant", required_argument, 0, 'v'},
+ {"options", required_argument, 0, 'o'},
+ {0, 0, 0, 0},
+ };
+
+ while (1) {
+ int c;
+ int option_index = 0;
+
+ c = getopt_long(argc, argv, "r:m:l:v:o:h", opts, &option_index);
+ if (c == -1)
+ break;
+
+ switch (c) {
case 'r':
rmlvo.rules = optarg;
break;