summaryrefslogtreecommitdiffstats
path: root/usr.sbin/kbdcontrol/kbdcontrol.c
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/kbdcontrol/kbdcontrol.c
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/kbdcontrol/kbdcontrol.c')
-rw-r--r--usr.sbin/kbdcontrol/kbdcontrol.c15
1 files changed, 13 insertions, 2 deletions
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