diff options
author | Søren Schmidt <sos@FreeBSD.org> | 1995-01-30 21:41:14 +0000 |
---|---|---|
committer | Søren Schmidt <sos@FreeBSD.org> | 1995-01-30 21:41:14 +0000 |
commit | 00e0cb65779e1bc51bd68442fcec844639d356e6 (patch) | |
tree | c128b22efb9d769bf24a4472db3da8c2d3a9b8c1 /usr.sbin | |
parent | 123222dbd72e7b71d7883a20b27687c3d87ef71d (diff) | |
download | src-00e0cb65779e1bc51bd68442fcec844639d356e6.tar.gz src-00e0cb65779e1bc51bd68442fcec844639d356e6.zip |
Added h option for setting the historysize.
fixed problem with Both n&C flags.
Notes
Notes:
svn path=/head/; revision=6046
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/kbdcontrol/kbdcontrol.c | 48 | ||||
-rw-r--r-- | usr.sbin/kbdcontrol/lex.l | 5 |
2 files changed, 28 insertions, 25 deletions
diff --git a/usr.sbin/kbdcontrol/kbdcontrol.c b/usr.sbin/kbdcontrol/kbdcontrol.c index b77e8499201b..47d8f90fd497 100644 --- a/usr.sbin/kbdcontrol/kbdcontrol.c +++ b/usr.sbin/kbdcontrol/kbdcontrol.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: kbdcontrol.c,v 1.3 1995/01/12 11:44:42 sos Exp $ + * $Id: kbdcontrol.c,v 1.4 1995/01/28 22:17:19 sos Exp $ */ #include <ctype.h> @@ -77,7 +77,7 @@ const int repeats[] = { 34, 38, 42, 46, 50, 55, 59, 63, const int ndelays = (sizeof(delays) / sizeof(int)); const int nrepeats = (sizeof(repeats) / sizeof(int)); int hex = 0; -int number, verbose = 0; +int number; char letter; @@ -324,6 +324,9 @@ print_key_definition_line(FILE *fp, int scancode, struct key_t *key) case 2: fprintf(fp, " N\n"); break; + case 3: + fprintf(fp, " B\n"); + break; } } @@ -420,9 +423,6 @@ set_functionkey(char *keynumstr, char *string) return; } strcpy(fkey.keydef, string); - if (verbose) - fprintf(stderr, "setting function key %d to <%s>\n", - fkey.keynum, fkey.keydef); fkey.keynum -= 1; if (ioctl(0, SETFKEY, &fkey) < 0) perror("setting function key"); @@ -456,12 +456,6 @@ badopt: } } - if (verbose) - if (bell) - fprintf(stderr, "setting visual bell\n"); - else - fprintf(stderr, "setting bell values to %d.%d\n", - duration, pitch); ioctl(0, CONS_BELLTYPE, &bell); if (!bell) fprintf(stderr, "[=%d;%dB", pitch, duration); @@ -509,14 +503,26 @@ badopt: rate.rep = n; } - if (verbose) - fprintf(stderr, "setting keyboard rate to %d.%d\n", - delays[rate.del], repeats[rate.rep]); if (ioctl(0, KDSETRAD, rate) < 0) perror("setting keyboard rate"); } +void +set_history(char *opt) +{ + int size; + + size = atoi(opt); + if ((*opt == '\0') || size < 0) { + fprintf(stderr, "argument must be a positive number\n"); + return; + } + if (ioctl(0, CONS_HISTORY, &size) == -1) + perror("setting history buffer size"); +} + + usage() { fprintf(stderr, @@ -524,13 +530,13 @@ usage() " -b normal | visual (set bell to visual type)\n" " -d (dump keyboard map to stdout)\n" " -l filename (load keyboard map file)\n" +" -h <N> (set history buffer size (in lines))\n" " -f <N> string (set function key N to send <string>)\n" " -F (set function keys back to default)\n" " -r delay.repeat (set keyboard delay & repeat rate)\n" " -r slow (set keyboard delay & repeat to slow)\n" " -r normal (set keyboard delay & repeat to normal)\n" " -r fast (set keyboard delay & repeat to fast)\n" -" -v (verbose)\n" ); } @@ -542,11 +548,7 @@ main(int argc, char **argv) extern int optind; int opt; - /* - if (!is_syscons(0)) - exit(1); - */ - while((opt = getopt(argc, argv, "b:df:Fl:r:vx")) != -1) + while((opt = getopt(argc, argv, "b:df:h:Fl:r:x")) != -1) switch(opt) { case 'b': set_bell_values(optarg); @@ -564,12 +566,12 @@ main(int argc, char **argv) case 'F': load_default_functionkeys(); break; + case 'h': + set_history(optarg); + break; case 'r': set_keyrates(optarg); break; - case 'v': - verbose = 1; - break; case 'x': hex = 1; break; diff --git a/usr.sbin/kbdcontrol/lex.l b/usr.sbin/kbdcontrol/lex.l index dd5b5c365e2f..d738a712a419 100644 --- a/usr.sbin/kbdcontrol/lex.l +++ b/usr.sbin/kbdcontrol/lex.l @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: lex.l,v 1.1 1994/08/17 08:59:36 sos Exp $ + * $Id: lex.l,v 1.2 1995/01/28 22:17:22 sos Exp $ */ %{ @@ -37,7 +37,7 @@ D [0-9] X [0-9a-fA-F] A . -L [OCN] +L [OCNB] %% @@ -111,6 +111,7 @@ scr{D}({D}*) { if (*yytext == 'O') number = 0; if (*yytext == 'C') number = 1; if (*yytext == 'N') number = 2; + if (*yytext == 'B') number = 3; return TFLAG; } [ \t\n] { /* ignore */ } |