Allow path where keyboard maps are looked for to be altered using environment
variable.
This commit is contained in:
parent
f6056f14ec
commit
b010fac286
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=76502
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user