[Midnightbsd-cvs] src [10311] trunk/usr.sbin/vidcontrol/vidcontrol.c: update vidcontrol

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Jun 3 14:58:05 EDT 2018


Revision: 10311
          http://svnweb.midnightbsd.org/src/?rev=10311
Author:   laffer1
Date:     2018-06-03 14:58:05 -0400 (Sun, 03 Jun 2018)
Log Message:
-----------
update vidcontrol

Modified Paths:
--------------
    trunk/usr.sbin/vidcontrol/Makefile
    trunk/usr.sbin/vidcontrol/decode.c
    trunk/usr.sbin/vidcontrol/decode.h
    trunk/usr.sbin/vidcontrol/path.h
    trunk/usr.sbin/vidcontrol/vidcontrol.1
    trunk/usr.sbin/vidcontrol/vidcontrol.c

Property Changed:
----------------
    trunk/usr.sbin/vidcontrol/vidcontrol.1

Modified: trunk/usr.sbin/vidcontrol/Makefile
===================================================================
--- trunk/usr.sbin/vidcontrol/Makefile	2018-06-03 18:57:28 UTC (rev 10310)
+++ trunk/usr.sbin/vidcontrol/Makefile	2018-06-03 18:58:05 UTC (rev 10311)
@@ -1,8 +1,7 @@
-# $FreeBSD: src/usr.sbin/vidcontrol/Makefile,v 1.6 2005/01/13 03:59:44 delphij Exp $
+# $MidnightBSD$
+# $FreeBSD: stable/10/usr.sbin/vidcontrol/Makefile 201390 2010-01-02 11:07:44Z ed $
 
 PROG=	vidcontrol
 SRCS=	vidcontrol.c decode.c
 
-WARNS?=	6
-
 .include <bsd.prog.mk>

Modified: trunk/usr.sbin/vidcontrol/decode.c
===================================================================
--- trunk/usr.sbin/vidcontrol/decode.c	2018-06-03 18:57:28 UTC (rev 10310)
+++ trunk/usr.sbin/vidcontrol/decode.c	2018-06-03 18:58:05 UTC (rev 10311)
@@ -1,5 +1,6 @@
+/* $MidnightBSD$ */
 /*-
- * Copyright (c) 1994 S\xF8ren Schmidt
+ * Copyright (c) 1994 Søren Schmidt
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -28,7 +29,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-  "$FreeBSD: src/usr.sbin/vidcontrol/decode.c,v 1.11 2005/01/13 03:59:44 delphij Exp $";
+  "$FreeBSD: stable/10/usr.sbin/vidcontrol/decode.c 228976 2011-12-30 00:59:08Z uqs $";
 #endif /* not lint */
 
 #include <stdio.h>

Modified: trunk/usr.sbin/vidcontrol/decode.h
===================================================================
--- trunk/usr.sbin/vidcontrol/decode.h	2018-06-03 18:57:28 UTC (rev 10310)
+++ trunk/usr.sbin/vidcontrol/decode.h	2018-06-03 18:58:05 UTC (rev 10311)
@@ -1,3 +1,4 @@
-/* $FreeBSD: src/usr.sbin/vidcontrol/decode.h,v 1.2 2001/04/09 17:24:29 sobomax Exp $ */
+/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/usr.sbin/vidcontrol/decode.h 75344 2001-04-09 17:24:29Z sobomax $ */
 
 int decode(FILE *fd, char *buffer, int len);

Modified: trunk/usr.sbin/vidcontrol/path.h
===================================================================
--- trunk/usr.sbin/vidcontrol/path.h	2018-06-03 18:57:28 UTC (rev 10310)
+++ trunk/usr.sbin/vidcontrol/path.h	2018-06-03 18:58:05 UTC (rev 10311)
@@ -1,4 +1,9 @@
+/* $MidnightBSD$ */
+/* $FreeBSD: stable/10/usr.sbin/vidcontrol/path.h 267540 2014-06-16 11:51:00Z ray $ */
+
 #define KEYMAP_PATH	"/usr/share/syscons/keymaps/"
 #define FONT_PATH	"/usr/share/syscons/fonts/"
 #define SCRNMAP_PATH	"/usr/share/syscons/scrnmaps/"
 
+#define VT_KEYMAP_PATH	"/usr/share/vt/keymaps/"
+#define VT_FONT_PATH	"/usr/share/vt/fonts/"

Modified: trunk/usr.sbin/vidcontrol/vidcontrol.1
===================================================================
--- trunk/usr.sbin/vidcontrol/vidcontrol.1	2018-06-03 18:57:28 UTC (rev 10310)
+++ trunk/usr.sbin/vidcontrol/vidcontrol.1	2018-06-03 18:58:05 UTC (rev 10311)
@@ -1,5 +1,6 @@
+.\" $MidnightBSD$
 .\"
-.\" vidcontrol - a utility for manipulating the syscons video driver
+.\" vidcontrol - a utility for manipulating the syscons or vt video driver
 .\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
@@ -11,7 +12,7 @@
 .\"    documentation and/or other materials provided with the distribution.
 .\"
 .\"     @(#)vidcontrol.1
-.\" $FreeBSD: src/usr.sbin/vidcontrol/vidcontrol.1,v 1.58 2006/12/22 23:23:59 ru Exp $
+.\" $FreeBSD: stable/10/usr.sbin/vidcontrol/vidcontrol.1 273921 2014-10-31 23:10:58Z dumbbell $
 .\"
 .Dd December 23, 2006
 .Dt VIDCONTROL 1
@@ -26,9 +27,11 @@
 .Op Fl c Ar appearance
 .Oo
 .Fl f
+.Oo
 .Op Ar size
 .Ar file
 .Oc
+.Oc
 .Op Fl g Ar geometry
 .Op Fl h Ar size
 .Op Fl i Cm adapter | mode
@@ -38,6 +41,7 @@
 .Op Fl r Ar foreground Ar background
 .Op Fl S Cm on | off
 .Op Fl s Ar number
+.Op Fl T Cm xterm | cons25
 .Op Fl t Ar N | Cm off
 .Op Ar mode
 .Op Ar foreground Op Ar background
@@ -47,9 +51,15 @@
 .Nm
 utility is used to set various options for the
 .Xr syscons 4
+or
+.Xr vt 4
 console driver,
 such as video mode, colors, cursor shape, screen output map, font and screen
 saver timeout.
+Only a small subset of options is supported by
+.Xr vt 4 .
+Unsupported options lead to error messages, typically including
+the text "Inappropriate ioctl for device".
 .Pp
 The following command line options are supported:
 .Bl -tag -width indent
@@ -129,8 +139,10 @@
 Print out current output screen map.
 .It Xo
 .Fl f
+.Oo
 .Op Ar size
 .Ar file
+.Oc
 .Xc
 Load font
 .Ar file
@@ -151,6 +163,14 @@
 .Nm
 will try to guess it from the size of font file.
 .Pp
+When using
+.Xr vt 4
+both
+.Ar size
+and
+.Ar font
+can be omitted, and the default font will be loaded.
+.Pp
 Note that older video cards, such as MDA and CGA, do not support
 software font.
 See also
@@ -157,8 +177,11 @@
 .Sx Video Mode Support
 and
 .Sx EXAMPLES
-below and the man page for
-.Xr syscons 4 .
+below and the man page for either
+.Xr syscons 4
+or
+.Xr vt 4
+(depending on which driver you use).
 .It Fl g Ar geometry
 Set the
 .Ar geometry
@@ -184,7 +207,10 @@
 Install screen output map file from
 .Ar screen_map .
 See also
-.Xr syscons 4 .
+.Xr syscons 4
+or
+.Xr vt 4
+(depending on which driver you use).
 .It Fl L
 Install default screen output map.
 .It Fl M Ar char
@@ -243,6 +269,8 @@
 .It Fl s Ar number
 Set the current vty to
 .Ar number .
+.It Fl T Cm xterm | cons25
+Switch between xterm and cons25 style terminal emulation.
 .It Fl t Ar N | Cm off
 Set the screensaver timeout to
 .Ar N
@@ -304,6 +332,9 @@
 option.
 See
 .Xr syscons 4
+or
+.Xr vt 4
+(depending on which driver you use)
 for more details on this kernel option.
 .Ss Format of Video Buffer Dump
 The
@@ -310,6 +341,9 @@
 .Nm
 utility uses the
 .Xr syscons 4
+.\" is it supported on vt(4)???
+or
+.Xr vt 4
 .Dv CONS_SCRSHOT
 .Xr ioctl 2
 to capture the current contents of the video buffer.
@@ -324,7 +358,6 @@
 and the second byte is the character's color attribute.
 .Pp
 The VGA color attribute byte looks like this:
-.Pp
 .Bl -column "X:X" "<00000000>" "width" "bright foreground color"
 .Sy "bits#		width	meaning"
 .Li "7	<X0000000>	1	character blinking"
@@ -451,9 +484,12 @@
 .Sh FILES
 .Bl -tag -width /usr/share/syscons/scrnmaps/foo-bar -compact
 .It Pa /usr/share/syscons/fonts/*
+.It Pa /usr/share/vt/fonts/*
 font files.
 .It Pa /usr/share/syscons/scrnmaps/*
-screen output map files.
+screen output map files (relevant for
+.Xr syscons 4
+only).
 .El
 .Sh EXAMPLES
 If you want to load
@@ -465,7 +501,10 @@
 .Dl vidcontrol -f 8x16 /usr/share/syscons/fonts/iso-8x16.fnt
 .Pp
 So long as the font file is in
-.Pa /usr/share/syscons/fonts ,
+.Pa /usr/share/syscons/fonts
+(if using syscons) or
+.Pa /usr/share/vt/fonts
+(if using vt),
 you may abbreviate the file name as
 .Pa iso-8x16 :
 .Pp
@@ -519,6 +558,7 @@
 .Xr screen 4 ,
 .Xr syscons 4 ,
 .Xr vga 4 ,
+.Xr vt 4 ,
 .Xr rc.conf 5 ,
 .Xr kldload 8 ,
 .Xr moused 8 ,


Property changes on: trunk/usr.sbin/vidcontrol/vidcontrol.1
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.sbin/vidcontrol/vidcontrol.c
===================================================================
--- trunk/usr.sbin/vidcontrol/vidcontrol.c	2018-06-03 18:57:28 UTC (rev 10310)
+++ trunk/usr.sbin/vidcontrol/vidcontrol.c	2018-06-03 18:58:05 UTC (rev 10311)
@@ -1,5 +1,6 @@
+/* $MidnightBSD$ */
 /*-
- * Copyright (c) 1994-1996 S\xF8ren Schmidt
+ * Copyright (c) 1994-1996 Søren Schmidt
  * All rights reserved.
  *
  * Portions of this software are based in part on the work of
@@ -33,7 +34,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-  "$FreeBSD: src/usr.sbin/vidcontrol/vidcontrol.c,v 1.54 2006/09/26 21:46:12 ru Exp $";
+  "$FreeBSD: stable/10/usr.sbin/vidcontrol/vidcontrol.c 313552 2017-02-10 15:02:56Z emaste $";
 #endif /* not lint */
 
 #include <ctype.h>
@@ -45,9 +46,12 @@
 #include <unistd.h>
 #include <sys/fbio.h>
 #include <sys/consio.h>
+#include <sys/endian.h>
 #include <sys/errno.h>
+#include <sys/param.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/sysctl.h>
 #include "path.h"
 #include "decode.h"
 
@@ -63,7 +67,7 @@
 /* Screen dump file format revision */
 #define DUMP_FMT_REV	1
 
-char 	legal_colors[16][16] = {
+static const char *legal_colors[16] = {
 	"black", "blue", "green", "cyan",
 	"red", "magenta", "brown", "white",
 	"grey", "lightblue", "lightgreen", "lightcyan",
@@ -70,7 +74,7 @@
 	"lightred", "lightmagenta", "yellow", "lightwhite"
 };
 
-struct {
+static struct {
 	int			active_vty;
 	vid_info_t		console_info;
 	unsigned char		screen_map[256];
@@ -78,20 +82,28 @@
 	struct video_info	video_mode_info;
 } cur_info;
 
-int	hex = 0;
-int	number;
-int	vesa_cols;
-int	vesa_rows;
-int	font_height;
-int	colors_changed;
-int	video_mode_changed;
-int	normal_fore_color, normal_back_color;
-int	revers_fore_color, revers_back_color;
-char	letter;
-struct	vid_info info;
-struct	video_info new_mode_info;
+struct vt4font_header {
+	uint8_t		magic[8];
+	uint8_t		width;
+	uint8_t		height;
+	uint16_t	pad;
+	uint32_t	glyph_count;
+	uint32_t	map_count[4];
+} __packed;
 
+static int	hex = 0;
+static int	vesa_cols;
+static int	vesa_rows;
+static int	font_height;
+static int	colors_changed;
+static int	video_mode_changed;
+static int	normal_fore_color, normal_back_color;
+static int	revers_fore_color, revers_back_color;
+static int	vt4_mode = 0;
+static struct	vid_info info;
+static struct	video_info new_mode_info;
 
+
 /*
  * Initialize revert data.
  *
@@ -117,7 +129,9 @@
 	if (ioctl(0, CONS_GETINFO, &cur_info.console_info) == -1)
 		errc(1, errno, "getting console information");
 
-	if (ioctl(0, GIO_SCRNMAP, &cur_info.screen_map) == -1)
+	/* vt(4) use unicode, so no screen mapping required. */
+	if (vt4_mode == 0 &&
+	    ioctl(0, GIO_SCRNMAP, &cur_info.screen_map) == -1)
 		errc(1, errno, "getting screen map");
 
 	if (ioctl(0, CONS_GET, &cur_info.video_mode_number) == -1)
@@ -155,7 +169,8 @@
 	fprintf(stderr, "\033[=%dH", cur_info.console_info.mv_rev.fore);
 	fprintf(stderr, "\033[=%dI", cur_info.console_info.mv_rev.back);
 
-	ioctl(0, PIO_SCRNMAP, &cur_info.screen_map);
+	if (vt4_mode == 0)
+		ioctl(0, PIO_SCRNMAP, &cur_info.screen_map);
 
 	if (cur_info.video_mode_number >= M_VESA_BASE)
 		ioctl(0, _IO('V', cur_info.video_mode_number - M_VESA_BASE),
@@ -181,16 +196,35 @@
 static void
 usage(void)
 {
-	fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n",
+	if (vt4_mode)
+		fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n",
+"usage: vidcontrol [-CHPpx] [-b color] [-c appearance] [-f [[size] file]]",
+"                  [-g geometry] [-h size] [-i adapter | mode]",
+"                  [-M char] [-m on | off] [-r foreground background]",
+"                  [-S on | off] [-s number] [-T xterm | cons25] [-t N | off]",
+"                  [mode] [foreground [background]] [show]");
+	else
+		fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n",
 "usage: vidcontrol [-CdHLPpx] [-b color] [-c appearance] [-f [size] file]",
 "                  [-g geometry] [-h size] [-i adapter | mode] [-l screen_map]",
 "                  [-M char] [-m on | off] [-r foreground background]",
-"                  [-S on | off] [-s number] [-t N | off] [mode]",
-"                  [foreground [background]] [show]");
+"                  [-S on | off] [-s number] [-T xterm | cons25] [-t N | off]",
+"                  [mode] [foreground [background]] [show]");
 	exit(1);
 }
 
+/* Detect presence of vt(4). */
+static int
+is_vt4(void)
+{
+	char vty_name[4] = "";
+	size_t len = sizeof(vty_name);
 
+	if (sysctlbyname("kern.vty", vty_name, &len, NULL, 0) != 0)
+		return (0);
+	return (strcmp(vty_name, "vt") == 0);
+}
+
 /*
  * Retrieve the next argument from the command line (for options that require
  * more than one argument).
@@ -351,8 +385,96 @@
 		return -1;
 }
 
+static vfnt_map_t *
+load_vt4mappingtable(unsigned int nmappings, FILE *f)
+{
+	vfnt_map_t *t;
+	unsigned int i;
 
+	if (nmappings == 0)
+		return (NULL);
+
+	if ((t = malloc(sizeof *t * nmappings)) == NULL) {
+		warn("malloc");
+		return (NULL);
+	}
+
+	if (fread(t, sizeof *t * nmappings, 1, f) != 1) {
+		warn("read mappings");
+		free(t);
+		return (NULL);
+	}
+
+	for (i = 0; i < nmappings; i++) {
+		t[i].src = be32toh(t[i].src);
+		t[i].dst = be16toh(t[i].dst);
+		t[i].len = be16toh(t[i].len);
+	}
+
+	return (t);
+}
+
 /*
+ * Set the default vt font.
+ */
+
+static void
+load_default_vt4font(void)
+{
+	if (ioctl(0, PIO_VFONT_DEFAULT) == -1) {
+		revert();
+		errc(1, errno, "loading default vt font");
+	}
+}
+
+static void
+load_vt4font(FILE *f)
+{
+	struct vt4font_header fh;
+	static vfnt_t vfnt;
+	size_t glyphsize;
+	unsigned int i;
+
+	if (fread(&fh, sizeof fh, 1, f) != 1) {
+		warn("read file_header");
+		return;
+	}
+
+	if (memcmp(fh.magic, "VFNT0002", 8) != 0) {
+		warnx("bad magic in font file\n");
+		return;
+	}
+
+	for (i = 0; i < VFNT_MAPS; i++)
+		vfnt.map_count[i] = be32toh(fh.map_count[i]);
+	vfnt.glyph_count = be32toh(fh.glyph_count);
+	vfnt.width = fh.width;
+	vfnt.height = fh.height;
+
+	glyphsize = howmany(vfnt.width, 8) * vfnt.height * vfnt.glyph_count;
+	if ((vfnt.glyphs = malloc(glyphsize)) == NULL) {
+		warn("malloc");
+		return;
+	}
+
+	if (fread(vfnt.glyphs, glyphsize, 1, f) != 1) {
+		warn("read glyphs");
+		free(vfnt.glyphs);
+		return;
+	}
+
+	for (i = 0; i < VFNT_MAPS; i++)
+		vfnt.map[i] = load_vt4mappingtable(vfnt.map_count[i], f);
+
+	if (ioctl(STDIN_FILENO, PIO_VFONT, &vfnt) == -1)
+		warn("PIO_VFONT");
+
+	for (i = 0; i < VFNT_MAPS; i++)
+		free(vfnt.map[i]);
+	free(vfnt.glyphs);
+}
+
+/*
  * Load a font from file and set it.
  */
 
@@ -364,6 +486,7 @@
 	unsigned long io = 0;	/* silence stupid gcc(1) in the Wall mode */
 	char	*name, *fontmap, size_sufx[6];
 	const char	*a[] = {"", FONT_PATH, NULL};
+	const char	*vt4a[] = {"", VT_FONT_PATH, NULL};
 	const char	*b[] = {filename, NULL};
 	const char	*c[] = {"", size_sufx, NULL};
 	const char	*d[] = {"", ".fnt", NULL};
@@ -378,21 +501,31 @@
 		     {8,  8,  PIO_FONT8x8},
 		     {0,  0,            0}};
 
-	_info.size = sizeof(_info);
-	if (ioctl(0, CONS_GETINFO, &_info) == -1) {
-		revert();
-		warn("failed to obtain current video mode parameters");
-		return;
+	if (vt4_mode) {
+		size_sufx[0] = '\0';
+	} else {
+		_info.size = sizeof(_info);
+		if (ioctl(0, CONS_GETINFO, &_info) == -1) {
+			revert();
+			warn("failed to obtain current video mode parameters");
+			return;
+		}
+
+		snprintf(size_sufx, sizeof(size_sufx), "-8x%d", _info.font_size);
 	}
+	fd = openguess((vt4_mode == 0) ? a : vt4a, b, c, d, &name);
 
-	snprintf(size_sufx, sizeof(size_sufx), "-8x%d", _info.font_size);
-	fd = openguess(a, b, c, d, &name);
-
 	if (fd == NULL) {
 		revert();
 		errx(1, "%s: can't load font file", filename);
 	}
 
+	if (vt4_mode) {
+		load_vt4font(fd);
+		fclose(fd);
+		return;
+	}
+
 	if (type != NULL) {
 		size = 0;
 		if (sscanf(type, "%dx%d", &w, &h) == 2) {
@@ -499,15 +632,15 @@
  */
 
 static void
-set_cursor_type(char *appearence)
+set_cursor_type(char *appearance)
 {
 	int type;
 
-	if (!strcmp(appearence, "normal"))
+	if (!strcmp(appearance, "normal"))
 		type = 0;
-	else if (!strcmp(appearence, "blink"))
+	else if (!strcmp(appearance, "blink"))
 		type = 1;
-	else if (!strcmp(appearence, "destructive"))
+	else if (!strcmp(appearance, "destructive"))
 		type = 3;
 	else {
 		revert();
@@ -950,10 +1083,11 @@
 static void
 show_mode_info(void)
 {
+	char buf[80];
 	struct video_info _info;
-	char buf[80];
+	int c;
+	int mm;
 	int mode;
-	int c;
 
 	printf("    mode#     flags   type    size       "
 	       "font      window      linear buffer\n");
@@ -972,9 +1106,35 @@
 		if (_info.vi_flags & V_INFO_GRAPHICS) {
 			c = 'G';
 
-			snprintf(buf, sizeof(buf), "%dx%dx%d %d",
-				 _info.vi_width, _info.vi_height, 
-				 _info.vi_depth, _info.vi_planes);
+			if (_info.vi_mem_model == V_INFO_MM_PLANAR)
+				snprintf(buf, sizeof(buf), "%dx%dx%d %d",
+				    _info.vi_width, _info.vi_height, 
+				    _info.vi_depth, _info.vi_planes);
+			else {
+				switch (_info.vi_mem_model) {
+				case V_INFO_MM_PACKED:
+					mm = 'P';
+					break;
+				case V_INFO_MM_DIRECT:
+					mm = 'D';
+					break;
+				case V_INFO_MM_CGA:
+					mm = 'C';
+					break;
+				case V_INFO_MM_HGC:
+					mm = 'H';
+					break;
+				case V_INFO_MM_VGAX:
+					mm = 'V';
+					break;
+				default:
+					mm = ' ';
+					break;
+				}
+				snprintf(buf, sizeof(buf), "%dx%dx%d %c",
+				    _info.vi_width, _info.vi_height, 
+				    _info.vi_depth, mm);
+			}
 		} else {
 			c = 'T';
 
@@ -1159,14 +1319,27 @@
 	}
 }
 
+static void
+set_terminal_mode(char *arg)
+{
 
+	if (strcmp(arg, "xterm") == 0)
+		fprintf(stderr, "\033[=T");
+	else if (strcmp(arg, "cons25") == 0)
+		fprintf(stderr, "\033[=1T");
+}
+
+
 int
 main(int argc, char **argv)
 {
-	char	*font, *type;
+	char    *font, *type, *termmode;
+	const char *opts;
 	int	dumpmod, dumpopt, opt;
 	int	reterr;
 
+	vt4_mode = is_vt4();
+
 	init();
 
 	info.size = sizeof(info);
@@ -1175,7 +1348,13 @@
 		err(1, "must be on a virtual console");
 	dumpmod = 0;
 	dumpopt = DUMP_FBF;
-	while((opt = getopt(argc, argv, "b:Cc:df:g:h:Hi:l:LM:m:pPr:S:s:t:x")) != -1)
+	termmode = NULL;
+	if (vt4_mode)
+		opts = "b:Cc:fg:h:Hi:M:m:pPr:S:s:T:t:x";
+	else
+		opts = "b:Cc:dfg:h:Hi:l:LM:m:pPr:S:s:T:t:x";
+
+	while ((opt = getopt(argc, argv, opts)) != -1)
 		switch(opt) {
 		case 'b':
 			set_border_color(optarg);
@@ -1187,18 +1366,28 @@
 			set_cursor_type(optarg);
 			break;
 		case 'd':
+			if (vt4_mode)
+				break;
 			print_scrnmap();
 			break;
 		case 'f':
-			type = optarg;
-			font = nextarg(argc, argv, &optind, 'f', 0);
+			optarg = nextarg(argc, argv, &optind, 'f', 0);
+			if (optarg != NULL) {
+				font = nextarg(argc, argv, &optind, 'f', 0);
 
-			if (font == NULL) {
-				type = NULL;
-				font = optarg;
+				if (font == NULL) {
+					type = NULL;
+					font = optarg;
+				} else
+					type = optarg;
+
+				load_font(type, font);
+			} else {
+				if (!vt4_mode)
+					usage(); /* Switch syscons to ROM? */
+
+				load_default_vt4font();
 			}
-
-			load_font(type, font);
 			break;
 		case 'g':
 			if (sscanf(optarg, "%dx%d",
@@ -1218,9 +1407,13 @@
 			show_info(optarg);
 			break;
 		case 'l':
+			if (vt4_mode)
+				break;
 			load_scrnmap(optarg);
 			break;
 		case 'L':
+			if (vt4_mode)
+				break;
 			load_default_scrnmap();
 			break;
 		case 'M':
@@ -1244,6 +1437,12 @@
 		case 's':
 			set_console(optarg);
 			break;
+		case 'T':
+			if (strcmp(optarg, "xterm") != 0 &&
+			    strcmp(optarg, "cons25") != 0)
+				usage();
+			termmode = optarg;
+			break;
 		case 't':
 			set_screensaver_timeout(optarg);
 			break;
@@ -1265,6 +1464,8 @@
 	}
 
 	video_mode(argc, argv, &optind);
+	if (termmode != NULL)
+		set_terminal_mode(termmode);
 
 	get_normal_colors(argc, argv, &optind);
 



More information about the Midnightbsd-cvs mailing list