summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/kbdcontrol/kbdcontrol.14
-rw-r--r--usr.sbin/kbdcontrol/kbdcontrol.c20
2 files changed, 16 insertions, 8 deletions
diff --git a/usr.sbin/kbdcontrol/kbdcontrol.1 b/usr.sbin/kbdcontrol/kbdcontrol.1
index f2eaf22..4d0baa9 100644
--- a/usr.sbin/kbdcontrol/kbdcontrol.1
+++ b/usr.sbin/kbdcontrol/kbdcontrol.1
@@ -145,6 +145,10 @@ compiled from it to stdout.
This option is primarily intended for programmers and is probably
of little use under normal circumstances.
.El
+.Sh ENVIRONMENT
+The environment variable
+.Ev KEYMAP_PATH
+can hold an alternative path to the keyboard map files.
.Sh KEYBOARD CONFIGURATION
.Ss Boot Time Configuration
You may set variables in
diff --git a/usr.sbin/kbdcontrol/kbdcontrol.c b/usr.sbin/kbdcontrol/kbdcontrol.c
index 935a8d25..8587a42 100644
--- a/usr.sbin/kbdcontrol/kbdcontrol.c
+++ b/usr.sbin/kbdcontrol/kbdcontrol.c
@@ -746,16 +746,20 @@ load_keymap(char *opt, int dumponly)
keymap_t keymap;
accentmap_t accentmap;
FILE *fd;
- int i;
+ int i, j;
char *name, *cp;
- char *prefix[] = {"", "", KEYMAP_PATH, KEYMAP_PATH, NULL};
- char *postfix[] = {"", ".kbd", "", ".kbd"};
+ char *prefix[] = {"", "", KEYMAP_PATH, NULL};
+ char *postfix[] = {"", ".kbd", NULL};
- for (i=0; prefix[i]; i++) {
- name = mkfullname(prefix[i], opt, postfix[i]);
- if ((fd = fopen(name, "r")))
- break;
- }
+ if (cp = getenv("KEYMAP_PATH"))
+ prefix[0] = mkfullname(cp, "/", "");
+
+ for (i=0; prefix[i]; i++)
+ for (j=0; postfix[j]; j++) {
+ name = mkfullname(prefix[i], opt, postfix[j]);
+ if ((fd = fopen(name, "r")))
+ prefix[i + 1] = postfix[j + 1] = NULL;
+ }
if (fd == NULL) {
warn("keymap file not found");
return;
OpenPOWER on IntegriCloud