diff options
author | Ran Benita <ran234@gmail.com> | 2012-09-30 10:42:30 +0200 |
---|---|---|
committer | Ran Benita <ran234@gmail.com> | 2012-09-30 14:20:16 +0200 |
commit | 693a1f57d14ed25aafaeb5f45d98a49ad365dc88 (patch) | |
tree | 68c004fd88d6904825451710580b3dc2f8badaec /test | |
parent | 26cc2f400a65b09b27a05349d0134201262dc437 (diff) |
test/interactive: allow -k to get any absolute path
Instead of looking for a keymap in test/data.
Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/interactive.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/test/interactive.c b/test/interactive.c index 66fffc9..6a5b3d8 100644 --- a/test/interactive.c +++ b/test/interactive.c @@ -466,11 +466,23 @@ main(int argc, char *argv[]) goto err_out; } - if (keymap_path) - keymap = test_compile_file(ctx, keymap_path); - else + if (keymap_path) { + FILE *file = fopen(keymap_path, "r"); + if (!file) { + ret = EXIT_FAILURE; + fprintf(stderr, "Couldn't open '%s': %s\n", + keymap_path, strerror(errno)); + goto err_ctx; + } + keymap = xkb_keymap_new_from_file(ctx, file, + XKB_KEYMAP_FORMAT_TEXT_V1, 0); + fclose(file); + } + else { keymap = test_compile_rules(ctx, rules, model, layout, variant, options); + } + if (!keymap) { ret = -1; fprintf(stderr, "Couldn't create xkb keymap\n"); |