diff --git a/usr.sbin/vidcontrol/vidcontrol.1 b/usr.sbin/vidcontrol/vidcontrol.1 index f4c9d211a55c..16495dd8dd6b 100644 --- a/usr.sbin/vidcontrol/vidcontrol.1 +++ b/usr.sbin/vidcontrol/vidcontrol.1 @@ -11,7 +11,7 @@ .\" documentation and/or other materials provided with the distribution. .\" .\" @(#)vidcontrol.1 -.\" $Id: vidcontrol.1,v 1.12 1997/10/27 07:52:08 charnier Exp $ +.\" $Id: vidcontrol.1,v 1.13 1998/09/15 18:16:39 sos Exp $ .\" .Dd May 22, 1994 .Dt VIDCONTROL 1 @@ -45,20 +45,39 @@ such as video mode, colors, cursors, scrnmaps, font and screensaver timeout. The following command line options are supported: .Bl -tag -width indent .It mode -Select a new video mode. The modes currently supported are: +Select a new video mode. The modes currently recognized are: +.Ar 40x25 , +.Ar 80x25 , +.Ar 80x30 , +.Ar 80x43 , +.Ar 80x50 , +.Ar 80x60 , +.Ar 132x25 , +.Ar 132x30 , +.Ar 132x43 , +.Ar 132x50 , +.Ar 132x60 , .Ar VGA_40x25 , .Ar VGA_80x25 , +.Ar VGA_80x30 , .Ar VGA_80x50 , +.Ar VGA_80x60 , .Ar EGA_80x25 , -.Ar EGA_80x43 . -On some laptops the modes -.Ar VGA_80x30 -and -.Ar VGA_80x60 -can be used. +.Ar EGA_80x43 , +.Ar VESA_132x25 , +.Ar VESA_132x30 , +.Ar VESA_132x43 , +.Ar VESA_132x50 , +.Ar VESA_132x60 . The graphic mode .Ar VGA_320x200 +and +.Ar VESA_800x600 can also be chosen. +Note that not all modes listed above may be supported by the video +hardware, and that the VESA BIOS support must be linked to the kernel +or loaded as a LKM if you wish to use VESA video modes or +132 column modes. .It fgcol Op bgcol Change colors when displaying text. Specify the foreground color (e.g. "vidcontrol white"), or both a foreground & background color diff --git a/usr.sbin/vidcontrol/vidcontrol.c b/usr.sbin/vidcontrol/vidcontrol.c index dbc2308e1bf2..1d8d4b24db02 100644 --- a/usr.sbin/vidcontrol/vidcontrol.c +++ b/usr.sbin/vidcontrol/vidcontrol.c @@ -28,7 +28,7 @@ #ifndef lint static const char rcsid[] = - "$Id: vidcontrol.c,v 1.20 1998/09/15 18:16:39 sos Exp $"; + "$Id: vidcontrol.c,v 1.21 1998/09/16 13:55:26 abial Exp $"; #endif /* not lint */ #include @@ -258,37 +258,47 @@ set_cursor_type(char *appearence) void video_mode(int argc, char **argv, int *index) { + static struct { + char *name; + unsigned long mode; + } modes[] = { + { "80x25", SW_TEXT_80x25 }, + { "80x30", SW_TEXT_80x30 }, + { "80x43", SW_TEXT_80x43 }, + { "80x50", SW_TEXT_80x50 }, + { "80x60", SW_TEXT_80x60 }, + { "132x25", SW_TEXT_132x25 }, + { "132x30", SW_TEXT_132x30 }, + { "132x43", SW_TEXT_132x43 }, + { "132x50", SW_TEXT_132x50 }, + { "132x60", SW_TEXT_132x60 }, + { "VGA_40x25", SW_VGA_C40x25 }, + { "VGA_80x25", SW_VGA_C80x25 }, + { "VGA_80x30", SW_VGA_C80x30 }, + { "VGA_80x50", SW_VGA_C80x50 }, + { "VGA_80x60", SW_VGA_C80x60 }, + { "VGA_320x200", SW_VGA_CG320 }, + { "EGA_80x25", SW_ENH_C80x25 }, + { "EGA_80x43", SW_ENH_C80x43 }, + { "VESA_132x25", SW_VESA_C132x25 }, + { "VESA_132x43", SW_VESA_C132x43 }, + { "VESA_132x50", SW_VESA_C132x50 }, + { "VESA_132x60", SW_VESA_C132x60 }, + { "VESA_800x600", SW_VESA_800x600 }, + { NULL }, + }; unsigned long mode; int size[3]; + int i; if (*index < argc) { - if (!strcmp(argv[*index], "VGA_40x25")) - mode = SW_VGA_C40x25; - else if (!strcmp(argv[*index], "VGA_80x25")) - mode = SW_VGA_C80x25; - else if (!strcmp(argv[*index], "VGA_80x30")) - mode = SW_VGA_C80x30; - else if (!strcmp(argv[*index], "VGA_80x50")) - mode = SW_VGA_C80x50; - else if (!strcmp(argv[*index], "VGA_80x60")) - mode = SW_VGA_C80x60; - else if (!strcmp(argv[*index], "VGA_320x200")) - mode = SW_VGA_CG320; - else if (!strcmp(argv[*index], "EGA_80x25")) - mode = SW_ENH_C80x25; - else if (!strcmp(argv[*index], "EGA_80x43")) - mode = SW_ENH_C80x43; - else if (!strcmp(argv[*index], "VESA_132x25")) - mode = SW_VESA_C132x25; - else if (!strcmp(argv[*index], "VESA_132x43")) - mode = SW_VESA_C132x43; - else if (!strcmp(argv[*index], "VESA_132x50")) - mode = SW_VESA_C132x50; - else if (!strcmp(argv[*index], "VESA_132x60")) - mode = SW_VESA_C132x60; - else if (!strcmp(argv[*index], "VESA_800x600")) - mode = SW_VESA_800x600; - else + for (i = 0; modes[i].name != NULL; ++i) { + if (!strcmp(argv[*index], modes[i].name)) { + mode = modes[i].mode; + break; + } + } + if (modes[i].name == NULL) return; if (ioctl(0, mode, NULL) < 0) warn("cannot set videomode");