kbdcontrol.c revision 5536
12088Ssos/*- 25536Ssos * Copyright (c) 1994-1995 S�ren Schmidt 32088Ssos * All rights reserved. 42088Ssos * 52088Ssos * Redistribution and use in source and binary forms, with or without 62088Ssos * modification, are permitted provided that the following conditions 72088Ssos * are met: 82088Ssos * 1. Redistributions of source code must retain the above copyright 92088Ssos * notice, this list of conditions and the following disclaimer. 102088Ssos * 2. Redistributions in binary form must reproduce the above copyright 112088Ssos * notice, this list of conditions and the following disclaimer in the 122088Ssos * documentation and/or other materials provided with the distribution. 132088Ssos * 3. The name of the author may not be used to endorse or promote products 142088Ssos * derived from this software withough specific prior written permission 152088Ssos * 162088Ssos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 172088Ssos * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 182088Ssos * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 192088Ssos * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 202088Ssos * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 212088Ssos * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 222088Ssos * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 232088Ssos * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 242088Ssos * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 252088Ssos * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 262088Ssos * 275536Ssos * $Id: kbdcontrol.c,v 1.2 1994/10/25 20:50:41 swallace Exp $ 282088Ssos */ 292088Ssos 302088Ssos#include <ctype.h> 312088Ssos#include <stdio.h> 323864Sswallace#include <string.h> 332088Ssos#include <machine/console.h> 342088Ssos#include "path.h" 352088Ssos#include "lex.h" 362088Ssos 372088Ssoschar ctrl_names[32][4] = { 382088Ssos "nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel", 392088Ssos "bs ", "ht ", "nl ", "vt ", "ff ", "cr ", "so ", "si ", 402088Ssos "dle", "dc1", "dc2", "dc3", "dc4", "nak", "syn", "etb", 412088Ssos "can", "em ", "sub", "esc", "fs ", "gs ", "rs ", "ns " 422088Ssos }; 432088Ssos 442088Ssoschar fkey_table[60][MAXFK] = { 452088Ssos/* 00-03 */ "\033[M", "\033[N", "\033[O", "\033[P", 462088Ssos/* 04-07 */ "\033[Q", "\033[R", "\033[S", "\033[T", 472088Ssos/* 08-0B */ "\033[U", "\033[V", "\033[W", "\033[X", 482088Ssos/* 0C-0F */ "\033[W", "\033[X", "\033[Y", "\033[Z", 492088Ssos/* 10-13 */ "\033[a", "\033[b", "\033[c", "\033[d", 502088Ssos/* 14-17 */ "\033[e", "\033[f", "\033[g", "\033[h", 512088Ssos/* 18-1B */ "\033[g", "\033[h", "\033[i", "\033[j", 522088Ssos/* 1C-1F */ "\033[k", "\033[l", "\033[m", "\033[n", 532088Ssos/* 20-23 */ "\033[o", "\033[p", "\033[q", "\033[r", 542088Ssos/* 24-27 */ "\033[g", "\033[h", "\033[i", "\033[j", 552088Ssos/* 28-2B */ "\033[k", "\033[l", "\033[m", "\033[n", 562088Ssos/* 2C-2F */ "\033[o", "\033[p", "\033[q", "\033[r", 572088Ssos/* 30-33 */ "\033[H", "\033[A", "\033[I", "-" , 582088Ssos/* 34-37 */ "\033[D", "\177" , "\033[C", "+" , 592088Ssos/* 38-3B */ "\033[F", "\033[B", "\033[G", "\033[L" 602088Ssos }; 612088Ssos 622088Ssosconst int delays[] = {250, 500, 750, 1000}; 632088Ssosconst int repeats[] = { 34, 38, 42, 46, 50, 55, 59, 63, 642088Ssos 68, 76, 84, 92, 100, 110, 118, 126, 652088Ssos 136, 152, 168, 184, 200, 220, 236, 252, 662088Ssos 272, 304, 336, 368, 400, 440, 472, 504}; 672088Ssosconst int ndelays = (sizeof(delays) / sizeof(int)); 682088Ssosconst int nrepeats = (sizeof(repeats) / sizeof(int)); 692088Ssosint hex = 0; 702088Ssosint number, verbose = 0; 712088Ssoschar letter; 722088Ssos 732088Ssos 742088Ssoschar * 752088Ssosnextarg(int ac, char **av, int *indp, int oc) 762088Ssos{ 772088Ssos if (*indp < ac) 782088Ssos return(av[(*indp)++]); 792088Ssos fprintf(stderr, "%s: option requires two arguments -- %c\n", av[0], oc); 802088Ssos usage(); 812088Ssos exit(1); 822088Ssos return(""); 832088Ssos} 842088Ssos 852088Ssos 862088Ssoschar * 872088Ssosmkfullname(const char *s1, const char *s2, const char *s3) 882088Ssos{ 895536Ssos static char *buf = NULL; 905536Ssos static int bufl = 0; 915536Ssos int f; 922088Ssos 932088Ssos f = strlen(s1) + strlen(s2) + strlen(s3) + 1; 942088Ssos if (f > bufl) 952088Ssos if (buf) 962088Ssos buf = (char *)realloc(buf, f); 972088Ssos else 982088Ssos buf = (char *)malloc(f); 992088Ssos if (!buf) { 1002088Ssos bufl = 0; 1012088Ssos return(NULL); 1022088Ssos } 1032088Ssos 1042088Ssos bufl = f; 1052088Ssos strcpy(buf, s1); 1062088Ssos strcat(buf, s2); 1072088Ssos strcat(buf, s3); 1082088Ssos return(buf); 1092088Ssos} 1102088Ssos 1112088Ssos 1122088Ssosint 1132088Ssosget_entry() 1142088Ssos{ 1152088Ssos switch (yylex()) { 1162088Ssos case TNOP: 1172088Ssos return NOP | 0x100; 1182088Ssos case TLSH: 1192088Ssos return LSH | 0x100; 1202088Ssos case TRSH: 1212088Ssos return RSH | 0x100; 1222088Ssos case TCLK: 1232088Ssos return CLK | 0x100; 1242088Ssos case TNLK: 1252088Ssos return NLK | 0x100; 1262088Ssos case TSLK: 1272088Ssos return SLK | 0x100; 1282088Ssos case TBTAB: 1292088Ssos return BTAB | 0x100; 1302088Ssos case TLALT: 1312088Ssos return LALT | 0x100; 1322088Ssos case TLCTR: 1332088Ssos return LCTR | 0x100; 1342088Ssos case TNEXT: 1352088Ssos return NEXT | 0x100; 1362088Ssos case TRCTR: 1372088Ssos return RCTR | 0x100; 1382088Ssos case TRALT: 1392088Ssos return RALT | 0x100; 1402088Ssos case TALK: 1412088Ssos return ALK | 0x100; 1422088Ssos case TASH: 1432088Ssos return ASH | 0x100; 1442088Ssos case TMETA: 1452088Ssos return META | 0x100; 1462088Ssos case TRBT: 1472088Ssos return RBT | 0x100; 1482088Ssos case TDBG: 1492088Ssos return DBG | 0x100; 1502088Ssos case TFUNC: 1512088Ssos if (F(number) > L_FN) 1522088Ssos return -1; 1532088Ssos return F(number) | 0x100; 1542088Ssos case TSCRN: 1552088Ssos if (S(number) > L_SCR) 1562088Ssos return -1; 1572088Ssos return S(number) | 0x100; 1582088Ssos case TLET: 1592088Ssos return (unsigned char)letter; 1602088Ssos case TNUM: 1612088Ssos if (number < 0 || number > 255) 1622088Ssos return -1; 1632088Ssos return number; 1642088Ssos default: 1652088Ssos return -1; 1662088Ssos } 1672088Ssos} 1682088Ssos 1692088Ssos 1702088Ssosint 1712088Ssosget_key_definition_line(FILE* fd, keymap_t *map) 1722088Ssos{ 1732088Ssos int i, def, scancode; 1742088Ssos 1752088Ssos yyin = fd; 1762088Ssos 1772088Ssos /* get scancode number */ 1782088Ssos if (yylex() != TNUM) 1792088Ssos return -1; 1802088Ssos if (number < 0 || number >= NUM_KEYS) 1812088Ssos return -1; 1822088Ssos scancode = number; 1832088Ssos 1842088Ssos /* get key definitions */ 1852088Ssos map->key[scancode].spcl = 0; 1862088Ssos for (i=0; i<NUM_STATES; i++) { 1872088Ssos if ((def = get_entry()) == -1) 1882088Ssos return -1; 1892088Ssos if (def & 0x100) 1902088Ssos map->key[scancode].spcl |= (0x80 >> i); 1912088Ssos map->key[scancode].map[i] = def & 0xFF; 1922088Ssos } 1932088Ssos /* get lock state key def */ 1942088Ssos if (yylex() != TFLAG) 1952088Ssos return -1; 1962088Ssos map->key[scancode].flgs = number; 1972088Ssos return scancode; 1982088Ssos} 1992088Ssos 2002088Ssos 2012088Ssosint 2022088Ssosprint_entry(FILE *fp, int value) 2032088Ssos{ 2042088Ssos int val = value & 0xFF; 2052088Ssos 2062088Ssos switch (value) { 2072088Ssos case NOP | 0x100: 2082088Ssos fprintf(fp, " nop "); 2092088Ssos break; 2102088Ssos case LSH | 0x100: 2112088Ssos fprintf(fp, " lshift"); 2122088Ssos break; 2132088Ssos case RSH | 0x100: 2142088Ssos fprintf(fp, " rshift"); 2152088Ssos break; 2162088Ssos case CLK | 0x100: 2172088Ssos fprintf(fp, " clock "); 2182088Ssos break; 2192088Ssos case NLK | 0x100: 2202088Ssos fprintf(fp, " nlock "); 2212088Ssos break; 2222088Ssos case SLK | 0x100: 2232088Ssos fprintf(fp, " slock "); 2242088Ssos break; 2252088Ssos case BTAB | 0x100: 2262088Ssos fprintf(fp, " btab "); 2272088Ssos break; 2282088Ssos case LALT | 0x100: 2292088Ssos fprintf(fp, " lalt "); 2302088Ssos break; 2312088Ssos case LCTR | 0x100: 2322088Ssos fprintf(fp, " lctrl "); 2332088Ssos break; 2342088Ssos case NEXT | 0x100: 2352088Ssos fprintf(fp, " nscr "); 2362088Ssos break; 2372088Ssos case RCTR | 0x100: 2382088Ssos fprintf(fp, " rctrl "); 2392088Ssos break; 2402088Ssos case RALT | 0x100: 2412088Ssos fprintf(fp, " ralt "); 2422088Ssos break; 2432088Ssos case ALK | 0x100: 2442088Ssos fprintf(fp, " alock "); 2452088Ssos break; 2462088Ssos case ASH | 0x100: 2472088Ssos fprintf(fp, " ashift"); 2482088Ssos break; 2492088Ssos case META | 0x100: 2502088Ssos fprintf(fp, " meta "); 2512088Ssos break; 2522088Ssos case RBT | 0x100: 2532088Ssos fprintf(fp, " boot "); 2542088Ssos break; 2552088Ssos case DBG | 0x100: 2562088Ssos fprintf(fp, " debug "); 2572088Ssos break; 2582088Ssos default: 2592088Ssos if (value & 0x100) { 2602088Ssos if (val >= F_FN && val <= L_FN) 2612088Ssos fprintf(fp, " fkey%02d", val - F_FN + 1); 2622088Ssos else if (val >= F_SCR && val <= L_SCR) 2632088Ssos fprintf(fp, " scr%02d ", val - F_SCR + 1); 2642088Ssos else if (hex) 2652088Ssos fprintf(fp, " 0x%02x ", val); 2662088Ssos else 2672088Ssos fprintf(fp, " %3d ", val); 2682088Ssos } 2692088Ssos else { 2702088Ssos if (val < ' ') 2712088Ssos fprintf(fp, " %s ", ctrl_names[val]); 2722088Ssos else if (val == 127) 2732088Ssos fprintf(fp, " del "); 2742088Ssos else if (isprint(val)) 2752088Ssos fprintf(fp, " '%c' ", val); 2762088Ssos else if (hex) 2772088Ssos fprintf(fp, " 0x%02x ", val); 2782088Ssos else 2792088Ssos fprintf(fp, " %3d ", val); 2802088Ssos } 2812088Ssos } 2822088Ssos} 2832088Ssos 2842088Ssos 2852088Ssosvoid 2862088Ssosprint_key_definition_line(FILE *fp, int scancode, struct key_t *key) 2872088Ssos{ 2882088Ssos int i, value; 2892088Ssos 2902088Ssos /* print scancode number */ 2912088Ssos if (hex) 2922088Ssos fprintf(fp, " 0x%02x ", scancode); 2932088Ssos else 2942088Ssos fprintf(fp, " %03d ", scancode); 2952088Ssos 2962088Ssos /* print key definitions */ 2972088Ssos for (i=0; i<NUM_STATES; i++) { 2982088Ssos if (key->spcl & (0x80 >> i)) 2992088Ssos print_entry(fp, key->map[i] | 0x100); 3002088Ssos else 3012088Ssos print_entry(fp, key->map[i]); 3022088Ssos } 3032088Ssos 3042088Ssos /* print lock state key def */ 3052088Ssos switch (key->flgs) { 3062088Ssos case 0: 3072088Ssos fprintf(fp, " O\n"); 3082088Ssos break; 3092088Ssos case 1: 3102088Ssos fprintf(fp, " C\n"); 3112088Ssos break; 3122088Ssos case 2: 3132088Ssos fprintf(fp, " N\n"); 3142088Ssos break; 3152088Ssos } 3162088Ssos} 3172088Ssos 3182088Ssos 3192088Ssosvoid 3202088Ssosload_keymap(char *opt) 3212088Ssos{ 3222088Ssos keymap_t map; 3232088Ssos FILE *fd; 3242088Ssos int scancode, i; 3252088Ssos char *name; 3262088Ssos char *prefix[] = {"", "", KEYMAP_PATH, NULL}; 3272088Ssos char *postfix[] = {"", ".kbd", ".kbd"}; 3282088Ssos 3292088Ssos for (i=0; prefix[i]; i++) { 3302088Ssos name = mkfullname(prefix[i], opt, postfix[i]); 3312088Ssos if (fd = fopen(name, "r")) 3322088Ssos break; 3332088Ssos } 3342088Ssos if (fd == NULL) { 3352088Ssos perror("keymap file not found"); 3362088Ssos return; 3372088Ssos } 3383864Sswallace memset(&map, 0, sizeof(map)); 3392088Ssos while (1) { 3402088Ssos if ((scancode = get_key_definition_line(fd, &map)) < 0) 3412088Ssos break; 3422088Ssos if (scancode > map.n_keys) map.n_keys = scancode; 3432088Ssos } 3442088Ssos if (ioctl(0, PIO_KEYMAP, &map) < 0) { 3452088Ssos perror("setting keymap"); 3462088Ssos fclose(fd); 3472088Ssos return; 3482088Ssos } 3492088Ssos} 3502088Ssos 3512088Ssos 3522088Ssosvoid 3532088Ssosprint_keymap() 3542088Ssos{ 3552088Ssos keymap_t map; 3562088Ssos int i; 3572088Ssos 3582088Ssos if (ioctl(0, GIO_KEYMAP, &map) < 0) { 3592088Ssos perror("getting keymap"); 3602088Ssos exit(1); 3612088Ssos } 3622088Ssos printf( 3632088Ssos"# alt\n" 3642088Ssos"# scan cntrl alt alt cntrl lock\n" 3652088Ssos"# code base shift cntrl shift alt shift cntrl shift state\n" 3662088Ssos"# ------------------------------------------------------------------\n" 3672088Ssos ); 3682088Ssos for (i=0; i<map.n_keys; i++) 3692088Ssos print_key_definition_line(stdout, i, &map.key[i]); 3702088Ssos} 3712088Ssos 3722088Ssos 3732088Ssosvoid 3742088Ssosload_default_functionkeys() 3752088Ssos{ 3762088Ssos fkeyarg_t fkey; 3772088Ssos int i; 3782088Ssos 3792088Ssos for (i=0; i<NUM_FKEYS; i++) { 3802088Ssos fkey.keynum = i; 3812088Ssos strcpy(fkey.keydef, fkey_table[i]); 3822088Ssos fkey.flen = strlen(fkey_table[i]); 3832088Ssos if (ioctl(0, SETFKEY, &fkey) < 0) 3842088Ssos perror("setting function key"); 3852088Ssos } 3862088Ssos} 3872088Ssos 3882088Ssosvoid 3892088Ssosset_functionkey(char *keynumstr, char *string) 3902088Ssos{ 3912088Ssos fkeyarg_t fkey; 3922088Ssos int keynum; 3932088Ssos 3942088Ssos if (!strcmp(keynumstr, "load") && !strcmp(string, "default")) { 3952088Ssos load_default_functionkeys(); 3962088Ssos return; 3972088Ssos } 3982088Ssos fkey.keynum = atoi(keynumstr); 3992088Ssos if (fkey.keynum < 1 || fkey.keynum > NUM_FKEYS) { 4002088Ssos fprintf(stderr, 4012088Ssos "function key number must be between 1 and %d\n", 4022088Ssos NUM_FKEYS); 4032088Ssos return; 4042088Ssos } 4052088Ssos if ((fkey.flen = strlen(string)) > MAXFK) { 4062088Ssos fprintf(stderr, "function key string too long (%d > %d)\n", 4072088Ssos fkey.flen, MAXFK); 4082088Ssos return; 4092088Ssos } 4102088Ssos strcpy(fkey.keydef, string); 4112088Ssos if (verbose) 4122088Ssos fprintf(stderr, "setting function key %d to <%s>\n", 4132088Ssos fkey.keynum, fkey.keydef); 4142088Ssos fkey.keynum -= 1; 4152088Ssos if (ioctl(0, SETFKEY, &fkey) < 0) 4162088Ssos perror("setting function key"); 4172088Ssos} 4182088Ssos 4192088Ssos 4202088Ssosvoid 4212088Ssosset_bell_values(char *opt) 4222088Ssos{ 4235536Ssos int bell, duration, pitch; 4242088Ssos 4255536Ssos if (!strcmp(opt, "visual")) 4265536Ssos bell = 1, duration = 1, pitch = 800; 4275536Ssos else if (!strcmp(opt, "normal")) 4285536Ssos bell = 0, duration = 1, pitch = 800; 4292088Ssos else { 4302088Ssos int n; 4312088Ssos char *v1; 4325536Ssos 4335536Ssos bell = 0; 4342088Ssos duration = strtol(opt, &v1, 0); 4352088Ssos if ((duration < 0) || (*v1 != '.')) 4362088Ssos goto badopt; 4372088Ssos opt = ++v1; 4382088Ssos pitch = strtol(opt, &v1, 0); 4392088Ssos if ((pitch < 0) || (*opt == '\0') || (*v1 != '\0')) { 4402088Ssosbadopt: 4412088Ssos fprintf(stderr, 4422088Ssos "argument to -b must be DURATION.PITCH\n"); 4432088Ssos return; 4442088Ssos } 4452088Ssos } 4462088Ssos 4472088Ssos if (verbose) 4485536Ssos if (bell) 4495536Ssos fprintf(stderr, "setting visual bell\n"); 4505536Ssos else 4515536Ssos fprintf(stderr, "setting bell values to %d.%d\n", 4525536Ssos duration, pitch); 4535536Ssos ioctl(0, CONS_BELLTYPE, &bell); 4545536Ssos if (!bell) 4555536Ssos fprintf(stderr, "[=%d;%dB", pitch, duration); 4562088Ssos} 4572088Ssos 4582088Ssos 4592088Ssosvoid 4602088Ssosset_keyrates(char *opt) 4612088Ssos{ 4622088Ssosstruct { 4632088Ssos int rep:5; 4642088Ssos int del:2; 4652088Ssos int pad:1; 4662088Ssos }rate; 4672088Ssos 4682088Ssos if (!strcmp(opt, "slow")) 4692088Ssos rate.del = 3, rate.rep = 31; 4702088Ssos else if (!strcmp(opt, "normal")) 4712088Ssos rate.del = 1, rate.rep = 15; 4722088Ssos else if (!strcmp(opt, "fast")) 4732088Ssos rate.del = rate.rep = 0; 4742088Ssos else { 4752088Ssos int n; 4762088Ssos int delay, repeat; 4772088Ssos char *v1; 4782088Ssos 4792088Ssos delay = strtol(opt, &v1, 0); 4802088Ssos if ((delay < 0) || (*v1 != '.')) 4812088Ssos goto badopt; 4822088Ssos opt = ++v1; 4832088Ssos repeat = strtol(opt, &v1, 0); 4842088Ssos if ((repeat < 0) || (*opt == '\0') || (*v1 != '\0')) { 4852088Ssosbadopt: 4862088Ssos fprintf(stderr, 4872088Ssos "argument to -r must be delay.repeat\n"); 4882088Ssos return; 4892088Ssos } 4902088Ssos for (n = 0; n < ndelays - 1; n++) 4912088Ssos if (delay <= delays[n]) 4922088Ssos break; 4932088Ssos rate.del = n; 4942088Ssos for (n = 0; n < nrepeats - 1; n++) 4952088Ssos if (repeat <= repeats[n]) 4962088Ssos break; 4972088Ssos rate.rep = n; 4982088Ssos } 4992088Ssos 5002088Ssos if (verbose) 5012088Ssos fprintf(stderr, "setting keyboard rate to %d.%d\n", 5022088Ssos delays[rate.del], repeats[rate.rep]); 5032088Ssos if (ioctl(0, KDSETRAD, rate) < 0) 5042088Ssos perror("setting keyboard rate"); 5052088Ssos} 5062088Ssos 5072088Ssos 5082088Ssosusage() 5092088Ssos{ 5102088Ssos fprintf(stderr, 5115536Ssos"Usage: kbdcontrol -b duration.pitch (set bell duration & pitch)\n" 5125536Ssos" -b normal | visual (set bell to visual type)\n" 5135536Ssos" -d (dump keyboard map to stdout)\n" 5145536Ssos" -l filename (load keyboard map file)\n" 5155536Ssos" -f <N> string (set function key N to send <string>)\n" 5165536Ssos" -F (set function keys back to default)\n" 5175536Ssos" -r delay.repeat (set keyboard delay & repeat rate)\n" 5185536Ssos" -r slow (set keyboard delay & repeat to slow)\n" 5195536Ssos" -r normal (set keyboard delay & repeat to normal)\n" 5205536Ssos" -r fast (set keyboard delay & repeat to fast)\n" 5215536Ssos" -v (verbose)\n" 5222088Ssos ); 5232088Ssos} 5242088Ssos 5252088Ssos 5262088Ssosvoid 5272088Ssosmain(int argc, char **argv) 5282088Ssos{ 5292088Ssos extern char *optarg; 5302088Ssos extern int optind; 5312088Ssos int opt; 5322088Ssos 5332088Ssos /* 5342088Ssos if (!is_syscons(0)) 5352088Ssos exit(1); 5362088Ssos */ 5372088Ssos while((opt = getopt(argc, argv, "b:df:Fl:r:vx")) != -1) 5382088Ssos switch(opt) { 5392088Ssos case 'b': 5402088Ssos set_bell_values(optarg); 5412088Ssos break; 5422088Ssos case 'd': 5432088Ssos print_keymap(); 5442088Ssos break; 5452088Ssos case 'l': 5462088Ssos load_keymap(optarg); 5472088Ssos break; 5482088Ssos case 'f': 5492088Ssos set_functionkey(optarg, 5502088Ssos nextarg(argc, argv, &optind, 'f')); 5512088Ssos break; 5522088Ssos case 'F': 5532088Ssos load_default_functionkeys(); 5542088Ssos break; 5552088Ssos case 'r': 5562088Ssos set_keyrates(optarg); 5572088Ssos break; 5582088Ssos case 'v': 5592088Ssos verbose = 1; 5602088Ssos break; 5612088Ssos case 'x': 5622088Ssos hex = 1; 5632088Ssos break; 5642088Ssos default: 5652088Ssos usage(); 5662088Ssos exit(1); 5672088Ssos } 5682088Ssos if ((optind != argc) || (argc == 1)) { 5692088Ssos usage(); 5702088Ssos exit(1); 5712088Ssos } 5722088Ssos exit(0); 5732088Ssos} 5742088Ssos 5752088Ssos 576