aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMaxim Sobolev <sobomax@FreeBSD.org>2001-05-12 09:16:09 +0000
committerMaxim Sobolev <sobomax@FreeBSD.org>2001-05-12 09:16:09 +0000
commitb010fac286d6d4c00524759b9e0b2f3ec24b39b8 (patch)
tree36dbe1913f4d17c13fc1b93c80de02e712f6a935 /usr.sbin
parentf6056f14ec197205f0a637ced1682dfa3865fb0d (diff)
Notes
Diffstat (limited to 'usr.sbin')
-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 f2eaf2222acd..4d0baa9c85e4 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 935a8d252b6f..8587a4253815 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;