aboutsummaryrefslogtreecommitdiffstats
path: root/kbd.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2019-04-15 16:12:53 +0200
committerGerd Hoffmann <kraxel@redhat.com>2019-04-15 16:12:53 +0200
commit2c6f46ddb8c2b76558f5145850fd4d339a66ba3a (patch)
treea7fe37e9ddcb693d390394da35e9ff9698112f9e /kbd.c
parent090307b7d3270c1bab3299c6e101c5577b5ad7c0 (diff)
downloadfbida-2c6f46ddb8c2b76558f5145850fd4d339a66ba3a.tar.gz
xkb: move xkb_configure to kbd.c
Diffstat (limited to 'kbd.c')
-rw-r--r--kbd.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/kbd.c b/kbd.c
index 9dd8241..7290d46 100644
--- a/kbd.c
+++ b/kbd.c
@@ -26,6 +26,34 @@ struct xkb_rule_names xkb_layout = {
.options = NULL,
};
+void xkb_configure(void)
+{
+ char line[128], *m, *v, *h;
+ FILE *fp;
+
+ fp = fopen("/etc/vconsole.conf", "r");
+ if (!fp)
+ return;
+ while (fgets(line, sizeof(line), fp)) {
+ if (strncmp(line, "KEYMAP=", 7) != 0)
+ continue;
+ m = line + 7;
+ if (*m == '"')
+ m++;
+ if ((h = strchr(m, '\n')) != NULL)
+ *h = 0;
+ if ((h = strchr(m, '"')) != NULL)
+ *h = 0;
+ v = strchr(m, '-');
+ if (v) {
+ *(v++) = 0;
+ xkb_layout.variant = strdup(v);
+ }
+ xkb_layout.layout = strdup(m);
+ }
+ fclose(fp);
+}
+
/* ---------------------------------------------------------------------- */
struct termctrl {