diff options
author | Bernhard Reutner-Fischer | 2008-05-19 08:18:50 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer | 2008-05-19 08:18:50 +0000 |
commit | ae4342ca3e30f7b11732ecda3ad15821e81bc314 (patch) | |
tree | 1878104940eac4649bc8add4d0b2893ab1cb0a94 /console-tools/loadkmap.c | |
parent | ee56e013cfb6304f66129afee7978b0864699419 (diff) | |
download | busybox-ae4342ca3e30f7b11732ecda3ad15821e81bc314.zip busybox-ae4342ca3e30f7b11732ecda3ad15821e81bc314.tar.gz |
- Rename getpty() to xgetpty() and adjust callers.
- Rewrite kbd_mode and setconsole
- Introduce and use console_make_active() and xopen_xwrite_close()
- honour buffer-reservation method as set by the user (dumpkmap, loadkmap)
- shrink rtcwake and some console-tools
Saves about 270 Bytes
Diffstat (limited to 'console-tools/loadkmap.c')
-rw-r--r-- | console-tools/loadkmap.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/console-tools/loadkmap.c b/console-tools/loadkmap.c index bea5a77..28e53eb 100644 --- a/console-tools/loadkmap.c +++ b/console-tools/loadkmap.c @@ -26,28 +26,26 @@ struct kbentry { #define MAX_NR_KEYMAPS 256 int loadkmap_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; -int loadkmap_main(int argc, char **argv ATTRIBUTE_UNUSED) +int loadkmap_main(int ATTRIBUTE_UNUSED argc, char **argv ATTRIBUTE_UNUSED) { struct kbentry ke; int i, j, fd; uint16_t ibuff[NR_KEYS]; - char flags[MAX_NR_KEYMAPS]; - char buff[7]; + RESERVE_CONFIG_BUFFER(flags,MAX_NR_KEYMAPS); - if (argc != 1) - bb_show_usage(); +/* bb_warn_ignoring_args(argc>=2);*/ fd = xopen(CURRENT_VC, O_RDWR); - xread(0, buff, 7); - if (strncmp(buff, BINARY_KEYMAP_MAGIC, 7)) - bb_error_msg_and_die("this is not a valid binary keymap"); + xread(STDIN_FILENO, flags, 7); + if (strncmp(flags, BINARY_KEYMAP_MAGIC, 7)) + bb_error_msg_and_die("not a valid binary keymap"); - xread(0, flags, MAX_NR_KEYMAPS); + xread(STDIN_FILENO, flags, MAX_NR_KEYMAPS); for (i = 0; i < MAX_NR_KEYMAPS; i++) { if (flags[i] == 1) { - xread(0, ibuff, NR_KEYS * sizeof(uint16_t)); + xread(STDIN_FILENO, ibuff, NR_KEYS * sizeof(uint16_t)); for (j = 0; j < NR_KEYS; j++) { ke.kb_index = j; ke.kb_table = i; @@ -57,6 +55,9 @@ int loadkmap_main(int argc, char **argv ATTRIBUTE_UNUSED) } } - if (ENABLE_FEATURE_CLEAN_UP) close(fd); - return 0; + if (ENABLE_FEATURE_CLEAN_UP) { + close(fd); + RELEASE_CONFIG_BUFFER(flags); + } + return EXIT_SUCCESS; } |