mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
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. MFC after: 1 week Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
f0067f2251
commit
1b4e36949a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=291377
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue