diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-09 13:23:04 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-09 13:23:04 +0000 |
commit | 8fafacd7ec2ea70cb46b28e59c4c9b7473c44ca9 (patch) | |
tree | 1bb0a04a59daf72f3b8c616c7d376330ba13bd4f /console-tools | |
parent | 42dfcd261204e8a055a41437679858e9fc9226e0 (diff) | |
download | busybox-w32-8fafacd7ec2ea70cb46b28e59c4c9b7473c44ca9.tar.gz busybox-w32-8fafacd7ec2ea70cb46b28e59c4c9b7473c44ca9.tar.bz2 busybox-w32-8fafacd7ec2ea70cb46b28e59c4c9b7473c44ca9.zip |
setkeycodes: something horrible happened here
to indentation... fixed now
Diffstat (limited to 'console-tools')
-rw-r--r-- | console-tools/setkeycodes.c | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/console-tools/setkeycodes.c b/console-tools/setkeycodes.c index 1428bf3f2..607b8c785 100644 --- a/console-tools/setkeycodes.c +++ b/console-tools/setkeycodes.c | |||
@@ -27,35 +27,34 @@ enum { | |||
27 | extern int | 27 | extern int |
28 | setkeycodes_main(int argc, char** argv) | 28 | setkeycodes_main(int argc, char** argv) |
29 | { | 29 | { |
30 | char *ep; | 30 | char *ep; |
31 | int fd, sc; | 31 | int fd, sc; |
32 | struct kbkeycode a; | 32 | struct kbkeycode a; |
33 | 33 | ||
34 | if (argc % 2 != 1 || argc < 2) { | 34 | if (argc % 2 != 1 || argc < 2) { |
35 | bb_show_usage(); | 35 | bb_show_usage(); |
36 | } | 36 | } |
37 | 37 | ||
38 | fd = get_console_fd(); | 38 | fd = get_console_fd(); |
39 | 39 | ||
40 | while (argc > 2) { | 40 | while (argc > 2) { |
41 | a.keycode = atoi(argv[2]); | 41 | a.keycode = atoi(argv[2]); |
42 | a.scancode = sc = strtol(argv[1], &ep, 16); | 42 | a.scancode = sc = strtol(argv[1], &ep, 16); |
43 | if (*ep) { | 43 | if (*ep) { |
44 | bb_error_msg_and_die("error reading SCANCODE: '%s'", argv[1]); | 44 | bb_error_msg_and_die("error reading SCANCODE: '%s'", argv[1]); |
45 | } | ||
46 | if (a.scancode > 127) { | ||
47 | a.scancode -= 0xe000; | ||
48 | a.scancode += 128; | ||
49 | } | ||
50 | if (a.scancode > 255 || a.keycode > 127) { | ||
51 | bb_error_msg_and_die("SCANCODE or KEYCODE outside bounds"); | ||
52 | } | ||
53 | if (ioctl(fd,KDSETKEYCODE,&a)) { | ||
54 | bb_perror_msg_and_die("failed to set SCANCODE %x to KEYCODE %d", sc, a.keycode); | ||
55 | } | ||
56 | argc -= 2; | ||
57 | argv += 2; | ||
45 | } | 58 | } |
46 | if (a.scancode > 127) { | ||
47 | a.scancode -= 0xe000; | ||
48 | a.scancode += 128; | ||
49 | } | ||
50 | if (a.scancode > 255 || a.keycode > 127) { | ||
51 | bb_error_msg_and_die("SCANCODE or KEYCODE outside bounds"); | ||
52 | } | ||
53 | if (ioctl(fd,KDSETKEYCODE,&a)) { | ||
54 | perror("KDSETKEYCODE"); | ||
55 | bb_error_msg_and_die("failed to set SCANCODE %x to KEYCODE %d", sc, a.keycode); | ||
56 | } | ||
57 | argc -= 2; | ||
58 | argv += 2; | ||
59 | } | ||
60 | return EXIT_SUCCESS; | 59 | return EXIT_SUCCESS; |
61 | } | 60 | } |