From 1b6b8f296eaf8070940373861171398bed15ab72 Mon Sep 17 00:00:00 2001
From: dd
Date: Sun, 27 May 2001 00:47:38 +0000
Subject: Add a -c option which clears the history buffer using the new
CONS_CLRHIST ioctl.
PR: 27616
Reviewed by: ru
---
usr.sbin/kbdcontrol/kbdcontrol.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
(limited to 'usr.sbin/kbdcontrol/kbdcontrol.c')
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;
--
cgit v1.1