Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Jan 2016 17:03:26 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r293335 - stable/10/usr.sbin/kbdmap
Message-ID:  <201601071703.u07H3QIa069985@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Thu Jan  7 17:03:26 2016
New Revision: 293335
URL: https://svnweb.freebsd.org/changeset/base/293335

Log:
  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.

Modified:
  stable/10/usr.sbin/kbdmap/kbdmap.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/kbdmap/kbdmap.c
==============================================================================
--- stable/10/usr.sbin/kbdmap/kbdmap.c	Thu Jan  7 17:02:34 2016	(r293334)
+++ stable/10/usr.sbin/kbdmap/kbdmap.c	Thu Jan  7 17:03:26 2016	(r293335)
@@ -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, c
  * 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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601071703.u07H3QIa069985>