Add a -c option which clears the history buffer using the new

CONS_CLRHIST ioctl.

PR:		27616
Reviewed by:	ru
This commit is contained in:
Dima Dorfman 2001-05-27 00:47:38 +00:00
parent b3c2cf17ee
commit 84d337151e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=77252
2 changed files with 18 additions and 5 deletions

View File

@ -13,15 +13,15 @@
.\" @(#)kbdcontrol.1
.\" $FreeBSD$
.\"
.Dd June 30, 1999
.Dd May 24, 2001
.Dt KBDCONTROL 1
.Os FreeBSD
.Os
.Sh NAME
.Nm kbdcontrol
.Nd a utility for manipulating the syscons console driver
.Sh SYNOPSIS
.Nm
.Op Fl dFKix
.Op Fl cdFKix
.Oo
.Fl b
.Ar duration . Ns Ar pitch | Ar belltype
@ -97,6 +97,8 @@ 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

View File

@ -980,6 +980,14 @@ set_history(char *opt)
warn("setting history buffer size");
}
void
clear_history()
{
if (ioctl(0, CONS_CLRHIST) == -1)
warn("clear history buffer");
}
static char
*get_kbd_type_name(int type)
{
@ -1079,7 +1087,7 @@ static void
usage()
{
fprintf(stderr, "%s\n%s\n%s\n",
"usage: kbdcontrol [-dFKix] [-b duration.pitch | [quiet.]belltype]",
"usage: kbdcontrol [-cdFKix] [-b duration.pitch | [quiet.]belltype]",
" [-r delay.repeat | speed] [-l mapfile] [-f # string]",
" [-h size] [-k device] [-L mapfile]");
exit(1);
@ -1091,11 +1099,14 @@ main(int argc, char **argv)
{
int opt;
while((opt = getopt(argc, argv, "b:df:h:iKk:Fl:L:r:x")) != -1)
while((opt = getopt(argc, argv, "b:cdf:h: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;