summaryrefslogtreecommitdiff
path: root/console-tools/dumpkmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'console-tools/dumpkmap.c')
-rw-r--r--console-tools/dumpkmap.c19
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;
}