diff options
author | des <des@FreeBSD.org> | 2001-05-28 11:05:28 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2001-05-28 11:05:28 +0000 |
commit | 7c380d00127e5c002ff524805ce2a0c8164684c7 (patch) | |
tree | f90e143680a1afb4f92e2d3fe2dd2f948d7a6068 /usr.sbin/vidcontrol | |
parent | 13b0e9b8e7b63dbad42826e41d056ecc3332f1f8 (diff) | |
download | FreeBSD-src-7c380d00127e5c002ff524805ce2a0c8164684c7.zip FreeBSD-src-7c380d00127e5c002ff524805ce2a0c8164684c7.tar.gz |
Move the scrollback controls from kbdcontrol to vidcontrol.
Also fix some style bugs in the code and poor language in the man pages.
Reviewed by: sobomax
Diffstat (limited to 'usr.sbin/vidcontrol')
-rw-r--r-- | usr.sbin/vidcontrol/vidcontrol.1 | 23 | ||||
-rw-r--r-- | usr.sbin/vidcontrol/vidcontrol.c | 156 |
2 files changed, 105 insertions, 74 deletions
diff --git a/usr.sbin/vidcontrol/vidcontrol.1 b/usr.sbin/vidcontrol/vidcontrol.1 index 38d9d4d..ef40a1b 100644 --- a/usr.sbin/vidcontrol/vidcontrol.1 +++ b/usr.sbin/vidcontrol/vidcontrol.1 @@ -13,34 +13,31 @@ .\" @(#)vidcontrol.1 .\" $FreeBSD$ .\" -.Dd June 30, 1999 +.Dd May 27, 2001 .Dt VIDCONTROL 1 .Os .Sh NAME .Nm vidcontrol -.Nd "a utility for manipulating the syscons console driver" +.Nd system console control and configuration utility .Sh SYNOPSIS .Nm +.Op Fl CdLPpx .Op Fl b Ar color .Op Fl c Ar appearance -.Op Fl d .Oo .Fl f .Op Ar size .Ar file .Oc .Op Fl g Ar geometry +.Op Fl h Ar size .Op Fl i Cm adapter | mode .Op Fl l Ar screen_map -.Op Fl L .Op Fl M Ar char .Op Fl m Cm on | off -.Op Fl p -.Op Fl P .Op Fl r Ar foreground Ar background .Op Fl s Ar number .Op Fl t Ar N | Cm off -.Op Fl x .Op Ar mode .Op Ar foreground Op Ar background .Op Cm show @@ -110,13 +107,15 @@ See the supported colors on a given platform. Set border color to .Ar color . This option may not be always supported by the video driver. +.It Fl C +Clear the history buffer. .It Fl c Cm normal | blink | destructive Change the cursor appearance. The cursor is either an inverting block .Pq Cm normal -that eventually can -.Cm blink . -Or it can be like the old hardware cursor +that can optionally +.Cm blink , +or it can be like the old hardware cursor .Pq Cm destructive . The latter is actually a simulation. .It Fl d @@ -166,6 +165,10 @@ See also and .Sx EXAMPLES below. +.It Fl h Cm size +Set the size of the history (scrollback) buffer to +.Cm size +lines. .It Fl i Cm adapter Shows info about the current video adapter. .It Fl i Cm mode diff --git a/usr.sbin/vidcontrol/vidcontrol.c b/usr.sbin/vidcontrol/vidcontrol.c index 97e36b4..87e1cea 100644 --- a/usr.sbin/vidcontrol/vidcontrol.c +++ b/usr.sbin/vidcontrol/vidcontrol.c @@ -73,10 +73,10 @@ static void usage() { fprintf(stderr, "%s\n%s\n%s\n%s\n", -"usage: vidcontrol [-b color] [-c appearance] [-d] [-f [size] file] [-g geometry]", -" [-i adapter | mode] [-l screen_map] [-L] [-m on | off]", -" [-M char] [-p] [-P] [-r foreground background] [-s number]", -" [-t N | off] [-x] [mode] [foreground [background]] [show]"); +"usage: vidcontrol [-CdLPpx] [-b color] [-c appearance] [-f [size] file]", +" [-g geometry] [-h size] [-i adapter | mode] [-l screen_map]", +" [-m on | off] [-M char] [-r foreground background] [-s num]", +" [-t N | off] [mode] [foreground [background]] [show]"); exit(1); } @@ -714,6 +714,28 @@ dump_screen(int mode) return; } +void +set_history(char *opt) +{ + int size; + + size = atoi(opt); + if ((*opt == '\0') || size < 0) { + warnx("argument must be a positive number"); + return; + } + if (ioctl(0, CONS_HISTORY, &size) == -1) + warn("setting history buffer size"); +} + +void +clear_history() +{ + + if (ioctl(0, CONS_CLRHIST) == -1) + warn("clear history buffer"); +} + int main(int argc, char **argv) { @@ -727,68 +749,74 @@ main(int argc, char **argv) /* Not reached */ if (ioctl(0, CONS_GETINFO, &info) < 0) err(1, "must be on a virtual console"); - while((opt = getopt(argc, argv, "b:c:df:g:i:l:LM:m:pPr:s:t:x")) != -1) + while((opt = getopt(argc, argv, "b:Cc:df:g:h:i:l:LM:m:pPr:s:t:x")) != -1) switch(opt) { - case 'b': - set_border_color(optarg); - break; - case 'c': - set_cursor_type(optarg); - break; - case 'd': - print_scrnmap(); - break; - case 'f': - type = optarg; - font = nextarg(argc, argv, &optind, 'f', 0); - if (font == NULL) { - type = NULL; - font = optarg; - } - load_font(type, font); - break; - case 'g': - if (sscanf(optarg, "%dx%d", &vesa_cols, - &vesa_rows) != 2) { - warnx("incorrect geometry: %s", optarg); - usage(); - } - break; - case 'i': - show_info(optarg); - break; - case 'l': - load_scrnmap(optarg); - break; - case 'L': - load_default_scrnmap(); - break; - case 'M': - set_mouse_char(optarg); - break; - case 'm': - set_mouse(optarg); - break; - case 'p': - dump_screen(DUMP_RAW); - break; - case 'P': - dump_screen(DUMP_TXT); - break; - case 'r': - set_reverse_colors(argc, argv, &optind); - break; - case 's': - set_console(optarg); - break; - case 't': - set_screensaver_timeout(optarg); - break; - case 'x': - hex = 1; - break; - default: + case 'b': + set_border_color(optarg); + break; + case 'C': + clear_history(); + break; + case 'c': + set_cursor_type(optarg); + break; + case 'd': + print_scrnmap(); + break; + case 'f': + type = optarg; + font = nextarg(argc, argv, &optind, 'f', 0); + if (font == NULL) { + type = NULL; + font = optarg; + } + load_font(type, font); + break; + case 'g': + if (sscanf(optarg, "%dx%d", &vesa_cols, + &vesa_rows) != 2) { + warnx("incorrect geometry: %s", optarg); usage(); + } + break; + case 'h': + set_history(optarg); + break; + case 'i': + show_info(optarg); + break; + case 'l': + load_scrnmap(optarg); + break; + case 'L': + load_default_scrnmap(); + break; + case 'M': + set_mouse_char(optarg); + break; + case 'm': + set_mouse(optarg); + break; + case 'p': + dump_screen(DUMP_RAW); + break; + case 'P': + dump_screen(DUMP_TXT); + break; + case 'r': + set_reverse_colors(argc, argv, &optind); + break; + case 's': + set_console(optarg); + break; + case 't': + set_screensaver_timeout(optarg); + break; + case 'x': + hex = 1; + break; + default: + usage(); } video_mode(argc, argv, &optind); set_normal_colors(argc, argv, &optind); |