summaryrefslogtreecommitdiffstats
path: root/usr.sbin/vidcontrol/vidcontrol.c
diff options
context:
space:
mode:
authoryokota <yokota@FreeBSD.org>1998-09-23 10:00:15 +0000
committeryokota <yokota@FreeBSD.org>1998-09-23 10:00:15 +0000
commit4e8d2c8cdb65ae0820d90d7b506261c954db9167 (patch)
tree02d72ced53f64ac3c015143dfb335e38482c3037 /usr.sbin/vidcontrol/vidcontrol.c
parentb326a281a93fffb9bf6a92d3a17a0c1f663fbd32 (diff)
downloadFreeBSD-src-4e8d2c8cdb65ae0820d90d7b506261c954db9167.zip
FreeBSD-src-4e8d2c8cdb65ae0820d90d7b506261c954db9167.tar.gz
VESA BIOS support update in syscons.
- Accept generic video mode names: 80x25, 80x30, etc. Specific video mode names, VGA_80x25, VESA_132x25, are still accpeted too. - Update the man page accordingly.
Diffstat (limited to 'usr.sbin/vidcontrol/vidcontrol.c')
-rw-r--r--usr.sbin/vidcontrol/vidcontrol.c66
1 files changed, 38 insertions, 28 deletions
diff --git a/usr.sbin/vidcontrol/vidcontrol.c b/usr.sbin/vidcontrol/vidcontrol.c
index dbc2308..1d8d4b2 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 <ctype.h>
@@ -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");
OpenPOWER on IntegriCloud