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
This commit is contained in:
parent
f82078861c
commit
031c57af94
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=77329
@ -13,15 +13,15 @@
|
||||
.\" @(#)kbdcontrol.1
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd May 24, 2001
|
||||
.Dd May 27, 2001
|
||||
.Dt KBDCONTROL 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm kbdcontrol
|
||||
.Nd a utility for manipulating the syscons console driver
|
||||
.Nd keyboard control and configuration utility
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl cdFKix
|
||||
.Op Fl dFKix
|
||||
.Oo
|
||||
.Fl b
|
||||
.Ar duration . Ns Ar pitch | Ar belltype
|
||||
@ -32,7 +32,6 @@
|
||||
.Oc
|
||||
.Op Fl l Ar keymap_file
|
||||
.Op Fl f Ar # Ar string
|
||||
.Op Fl h Ar size
|
||||
.Op Fl k Ar keyboard_device
|
||||
.Op Fl L Ar keymap_file
|
||||
.Sh DESCRIPTION
|
||||
@ -97,8 +96,6 @@ Install keyboard map file from
|
||||
.Ar keymap_file .
|
||||
You may load the keyboard map file from a menu-driven command,
|
||||
.Xr kbdmap 1 .
|
||||
.It Fl c
|
||||
Clear the history buffer.
|
||||
.It Fl d
|
||||
Dump the current keyboard map onto stdout.
|
||||
The output may be redirected to a file and can be loaded
|
||||
@ -117,10 +114,6 @@ for available function keys and their numbers.
|
||||
Set function keys back to the standard definitions.
|
||||
.It Fl x
|
||||
Use hexadecimal numbers in keyboard map dump.
|
||||
.It Fl h Ar size
|
||||
Set history buffer size to
|
||||
.Ar size
|
||||
lines.
|
||||
.It Fl i
|
||||
Print brief information about the keyboard.
|
||||
.It Fl K
|
||||
|
@ -965,33 +965,6 @@ set_keyrates(char *opt)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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()
|
||||
{
|
||||
|
||||
#ifdef CONS_CLRHIST
|
||||
if (ioctl(0, CONS_CLRHIST) == -1)
|
||||
warn("clear history buffer");
|
||||
#else
|
||||
warnx("clearing history not supported");
|
||||
#endif
|
||||
}
|
||||
|
||||
static char
|
||||
*get_kbd_type_name(int type)
|
||||
{
|
||||
@ -1091,9 +1064,9 @@ static void
|
||||
usage()
|
||||
{
|
||||
fprintf(stderr, "%s\n%s\n%s\n",
|
||||
"usage: kbdcontrol [-cdFKix] [-b duration.pitch | [quiet.]belltype]",
|
||||
"usage: kbdcontrol [-dFKix] [-b duration.pitch | [quiet.]belltype]",
|
||||
" [-r delay.repeat | speed] [-l mapfile] [-f # string]",
|
||||
" [-h size] [-k device] [-L mapfile]");
|
||||
" [-k device] [-L mapfile]");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -1103,50 +1076,44 @@ main(int argc, char **argv)
|
||||
{
|
||||
int opt;
|
||||
|
||||
while((opt = getopt(argc, argv, "b:cdf:h:iKk:Fl:L:r:x")) != -1)
|
||||
while((opt = getopt(argc, argv, "b:df:iKk:Fl:L:r:x")) != -1)
|
||||
switch(opt) {
|
||||
case 'b':
|
||||
set_bell_values(optarg);
|
||||
break;
|
||||
case 'c':
|
||||
clear_history();
|
||||
break;
|
||||
case 'd':
|
||||
print_keymap();
|
||||
break;
|
||||
case 'l':
|
||||
load_keymap(optarg, 0);
|
||||
break;
|
||||
case 'L':
|
||||
load_keymap(optarg, 1);
|
||||
break;
|
||||
case 'f':
|
||||
set_functionkey(optarg,
|
||||
nextarg(argc, argv, &optind, 'f'));
|
||||
break;
|
||||
case 'F':
|
||||
load_default_functionkeys();
|
||||
break;
|
||||
case 'h':
|
||||
set_history(optarg);
|
||||
break;
|
||||
case 'i':
|
||||
show_kbd_info();
|
||||
break;
|
||||
case 'K':
|
||||
release_keyboard();
|
||||
break;
|
||||
case 'k':
|
||||
set_keyboard(optarg);
|
||||
break;
|
||||
case 'r':
|
||||
set_keyrates(optarg);
|
||||
break;
|
||||
case 'x':
|
||||
hex = 1;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
case 'b':
|
||||
set_bell_values(optarg);
|
||||
break;
|
||||
case 'd':
|
||||
print_keymap();
|
||||
break;
|
||||
case 'l':
|
||||
load_keymap(optarg, 0);
|
||||
break;
|
||||
case 'L':
|
||||
load_keymap(optarg, 1);
|
||||
break;
|
||||
case 'f':
|
||||
set_functionkey(optarg,
|
||||
nextarg(argc, argv, &optind, 'f'));
|
||||
break;
|
||||
case 'F':
|
||||
load_default_functionkeys();
|
||||
break;
|
||||
case 'i':
|
||||
show_kbd_info();
|
||||
break;
|
||||
case 'K':
|
||||
release_keyboard();
|
||||
break;
|
||||
case 'k':
|
||||
set_keyboard(optarg);
|
||||
break;
|
||||
case 'r':
|
||||
set_keyrates(optarg);
|
||||
break;
|
||||
case 'x':
|
||||
hex = 1;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
if ((optind != argc) || (argc == 1))
|
||||
usage();
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user