summaryrefslogtreecommitdiffstats
path: root/usr.sbin/kbdcontrol
diff options
context:
space:
mode:
authorsobomax <sobomax@FreeBSD.org>2001-05-12 09:16:09 +0000
committersobomax <sobomax@FreeBSD.org>2001-05-12 09:16:09 +0000
commit91ffa34b5cb9e31e6e76240b292b5e7655287f3b (patch)
tree5a039490e4381cb851e6417736d2c68c7afb8fde /usr.sbin/kbdcontrol
parent83375e931273ed4ecb5865a598522b3a990d3b31 (diff)
downloadFreeBSD-src-91ffa34b5cb9e31e6e76240b292b5e7655287f3b.zip
FreeBSD-src-91ffa34b5cb9e31e6e76240b292b5e7655287f3b.tar.gz
Allow path where keyboard maps are looked for to be altered using environment
variable.
Diffstat (limited to 'usr.sbin/kbdcontrol')
-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