summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authordd <dd@FreeBSD.org>2001-05-27 00:47:38 +0000
committerdd <dd@FreeBSD.org>2001-05-27 00:47:38 +0000
commit1b6b8f296eaf8070940373861171398bed15ab72 (patch)
treea46a1d7c76a5c01c09757aa7916832b2c4157b5d /usr.sbin
parentf5638c42a681d28ab2299c163004fe84b9d9641a (diff)
downloadFreeBSD-src-1b6b8f296eaf8070940373861171398bed15ab72.zip
FreeBSD-src-1b6b8f296eaf8070940373861171398bed15ab72.tar.gz
Add a -c option which clears the history buffer using the new
CONS_CLRHIST ioctl. PR: 27616 Reviewed by: ru
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/kbdcontrol/kbdcontrol.18
-rw-r--r--usr.sbin/kbdcontrol/kbdcontrol.c15
2 files changed, 18 insertions, 5 deletions
diff --git a/usr.sbin/kbdcontrol/kbdcontrol.1 b/usr.sbin/kbdcontrol/kbdcontrol.1
index 460a50a..2197b9b 100644
--- a/usr.sbin/kbdcontrol/kbdcontrol.1
+++ b/usr.sbin/kbdcontrol/kbdcontrol.1
@@ -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
diff --git a/usr.sbin/kbdcontrol/kbdcontrol.c b/usr.sbin/kbdcontrol/kbdcontrol.c
index 14ff0f3..b91e8b6 100644
--- a/usr.sbin/kbdcontrol/kbdcontrol.c
+++ b/usr.sbin/kbdcontrol/kbdcontrol.c
@@ -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;
OpenPOWER on IntegriCloud