1 Make the showkey's "-a" option default instead of "-k"
3 By Dennis Groenen <dennis_groenen@hotmail.com> - 2011-05-27
6 --- a/console-tools/showkey.c
7 +++ b/console-tools/showkey.c
8 @@ -46,8 +46,8 @@ int showkey_main(int argc, char **argv)
9 int showkey_main(int argc UNUSED_PARAM, char **argv)
12 - OPT_a = (1<<0), // display the decimal/octal/hex values of the keys
13 - OPT_k = (1<<1), // display only the interpreted keycodes (default)
14 + OPT_a = (1<<0), // display the decimal/octal/hex values of the keys (default)
15 + OPT_k = (1<<1), // display only the interpreted keycodes
16 OPT_s = (1<<2), // display only the raw scan-codes
19 @@ -63,20 +63,7 @@ int showkey_main(int argc UNUSED_PARAM,
21 #define press_keys "Press any keys, program terminates %s:\r\n\n"
23 - if (option_mask32 & OPT_a) {
24 - // just read stdin char by char
27 - printf(press_keys, "on EOF (ctrl-D)");
29 - // read and show byte values
30 - while (1 == read(STDIN_FILENO, &c, 1)) {
31 - printf("%3u 0%03o 0x%02x\r\n", c, c, c);
32 - if (04 /*CTRL-D*/ == c)
37 + if (option_mask32 & OPT_k || option_mask32 & OPT_s) {
38 // we assume a PC keyboard
39 xioctl(STDIN_FILENO, KDGKBMODE, &kbmode);
40 printf("Keyboard mode was %s.\r\n\n",
41 @@ -133,6 +120,19 @@ int showkey_main(int argc UNUSED_PARAM,
43 // restore keyboard mode
44 xioctl(STDIN_FILENO, KDSKBMODE, (void *)(ptrdiff_t)kbmode);
47 + // just read stdin char by char
50 + printf(press_keys, "on EOF (ctrl-D)");
52 + // read and show byte values
53 + while (1 == read(STDIN_FILENO, &c, 1)) {
54 + printf("%3u 0%03o 0x%02x\r\n", c, c, c);
55 + if (04 /*CTRL-D*/ == c)
60 // // restore console settings
61 --- a/include/usage.src.h
62 +++ b/include/usage.src.h
63 @@ -3488,8 +3488,8 @@ INSERT
64 #define showkey_full_usage "\n\n" \
65 "Show keys pressed\n" \
67 - "\n -a Display decimal/octal/hex values of the keys" \
68 - "\n -k Display interpreted keycodes (default)" \
69 + "\n -a Display decimal/octal/hex values of the keys (default)" \
70 + "\n -k Display interpreted keycodes" \
71 "\n -s Display raw scan-codes" \
73 #define slattach_trivial_usage \