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.1 | 8 +++++--- usr.sbin/kbdcontrol/kbdcontrol.c | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 5 deletions(-) (limited to 'usr.sbin') 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; -- cgit v1.1