From 8fafacd7ec2ea70cb46b28e59c4c9b7473c44ca9 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sat, 9 Sep 2006 13:23:04 +0000 Subject: setkeycodes: something horrible happened here to indentation... fixed now --- console-tools/setkeycodes.c | 47 ++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 24 deletions(-) (limited to 'console-tools/setkeycodes.c') 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 { extern int setkeycodes_main(int argc, char** argv) { - char *ep; - int fd, sc; - struct kbkeycode a; + char *ep; + int fd, sc; + struct kbkeycode a; - if (argc % 2 != 1 || argc < 2) { - bb_show_usage(); + if (argc % 2 != 1 || argc < 2) { + bb_show_usage(); } fd = get_console_fd(); - while (argc > 2) { - a.keycode = atoi(argv[2]); - a.scancode = sc = strtol(argv[1], &ep, 16); - if (*ep) { - bb_error_msg_and_die("error reading SCANCODE: '%s'", argv[1]); + while (argc > 2) { + a.keycode = atoi(argv[2]); + a.scancode = sc = strtol(argv[1], &ep, 16); + if (*ep) { + bb_error_msg_and_die("error reading SCANCODE: '%s'", argv[1]); + } + if (a.scancode > 127) { + a.scancode -= 0xe000; + a.scancode += 128; + } + if (a.scancode > 255 || a.keycode > 127) { + bb_error_msg_and_die("SCANCODE or KEYCODE outside bounds"); + } + if (ioctl(fd,KDSETKEYCODE,&a)) { + bb_perror_msg_and_die("failed to set SCANCODE %x to KEYCODE %d", sc, a.keycode); + } + argc -= 2; + argv += 2; } - if (a.scancode > 127) { - a.scancode -= 0xe000; - a.scancode += 128; - } - if (a.scancode > 255 || a.keycode > 127) { - bb_error_msg_and_die("SCANCODE or KEYCODE outside bounds"); - } - if (ioctl(fd,KDSETKEYCODE,&a)) { - perror("KDSETKEYCODE"); - bb_error_msg_and_die("failed to set SCANCODE %x to KEYCODE %d", sc, a.keycode); - } - argc -= 2; - argv += 2; - } return EXIT_SUCCESS; } -- cgit v1.2.3