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/dumpkmap.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/dumpkmap.c')
-rw-r--r-- | console-tools/dumpkmap.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/console-tools/dumpkmap.c b/console-tools/dumpkmap.c index 40b58f7..1adfdd7 100644 --- a/console-tools/dumpkmap.c +++ b/console-tools/dumpkmap.c @@ -7,6 +7,7 @@ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. * */ +/* no options, no getopt */ #include "libbb.h" @@ -23,18 +24,17 @@ struct kbentry { #define MAX_NR_KEYMAPS 256 int dumpkmap_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; -int dumpkmap_main(int argc, char **argv) +int dumpkmap_main(int ATTRIBUTE_UNUSED argc, char ATTRIBUTE_UNUSED **argv) { struct kbentry ke; int i, j, fd; - char flags[MAX_NR_KEYMAPS]; + RESERVE_CONFIG_BUFFER(flags,MAX_NR_KEYMAPS); - if (argc >= 2 && argv[1][0] == '-') - bb_show_usage(); +/* bb_warn_ignoring_args(argc>=2);*/ fd = xopen(CURRENT_VC, O_RDWR); - write(1, "bkeymap", 7); + write(STDOUT_FILENO, "bkeymap", 7); /* Here we want to set everything to 0 except for indexes: * [0-2] [4-6] [8-10] [12] */ @@ -43,7 +43,7 @@ int dumpkmap_main(int argc, char **argv) flags[3] = flags[7] = flags[11] = 0; /* dump flags */ - write(1, flags, MAX_NR_KEYMAPS); + write(STDOUT_FILENO, flags, MAX_NR_KEYMAPS); for (i = 0; i < MAX_NR_KEYMAPS; i++) { if (flags[i] == 1) { @@ -56,11 +56,14 @@ int dumpkmap_main(int argc, char **argv) (char *)&ke.kb_table, &ke.kb_value) ) { - write(1, (void*)&ke.kb_value, 2); + write(STDOUT_FILENO, (void*)&ke.kb_value, 2); } } } } - close(fd); + if (ENABLE_FEATURE_CLEAN_UP) { + close(fd); + RELEASE_CONFIG_BUFFER(flags); + } return EXIT_SUCCESS; } |