diff options
author | emaste <emaste@FreeBSD.org> | 2016-01-07 17:03:26 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2016-01-07 17:03:26 +0000 |
commit | 679061fa19d93019df7a5dd2bde1766016b5871a (patch) | |
tree | 4332ddbbc2a817aed2807456b674ceabc94169a6 | |
parent | e7b112012dcca2e1a25fae7b7f859d56c3ae6266 (diff) | |
download | FreeBSD-src-679061fa19d93019df7a5dd2bde1766016b5871a.zip FreeBSD-src-679061fa19d93019df7a5dd2bde1766016b5871a.tar.gz |
MFC r291377: vidfont: with vt(4) omit size from vidcontrol -f
When using syscons, vidfont extracts the font size from the filename
passes it to vidcontrol -f. In vt(4) mode the size argument is not
required, and some of the fonts in /usr/share/vt/fonts do not have the
size in the filename, which caused vidfont to fail. Thus, just omit the
size argument in vt(4) mode.
-rw-r--r-- | usr.sbin/kbdmap/kbdmap.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/usr.sbin/kbdmap/kbdmap.c b/usr.sbin/kbdmap/kbdmap.c index 08c0d77..4f983a5 100644 --- a/usr.sbin/kbdmap/kbdmap.c +++ b/usr.sbin/kbdmap/kbdmap.c @@ -57,6 +57,7 @@ static const char *dir; static const char *menu = ""; static int x11; +static int using_vt; static int show; static int verbose; static int print; @@ -150,7 +151,7 @@ add_keymap(const char *desc, int mark, const char *keym) * Return 0 if syscons is in use (to select legacy defaults). */ static int -check_newcons(void) +check_vt(void) { size_t len; char term[3]; @@ -159,7 +160,7 @@ check_newcons(void) if (sysctlbyname("kern.vty", &term, &len, NULL, 0) != 0 || strcmp(term, "vt") != 0) return 0; - return -1; + return 1; } /* @@ -256,7 +257,7 @@ get_font(void) static void vidcontrol(const char *fnt) { - char *tmp, *p, *q; + char *tmp, *p, *q, *cmd; char ch; int i; @@ -264,6 +265,13 @@ vidcontrol(const char *fnt) if (x11) return; + if (using_vt) { + asprintf(&cmd, "vidcontrol -f %s", fnt); + system(cmd); + free(cmd); + return; + } + tmp = strdup(fnt); /* Extract font size */ @@ -281,7 +289,6 @@ vidcontrol(const char *fnt) if (sscanf(p, "%dx%d%c", &i, &i, &ch) != 2) fprintf(stderr, "Which font size? %s\n", fnt); else { - char *cmd; asprintf(&cmd, "vidcontrol -f %s %s", p, fnt); if (verbose) fprintf(stderr, "%s\n", cmd); @@ -832,7 +839,8 @@ main(int argc, char **argv) sleep(2); } - if (check_newcons() == 0) { + using_vt = check_vt(); + if (using_vt == 0) { keymapdir = DEFAULT_SC_KEYMAP_DIR; fontdir = DEFAULT_SC_FONT_DIR; font_default = DEFAULT_SC_FONT; |