Shutdown sending on the socket when stdin closes.
[oweals/busybox.git] / console-tools / dumpkmap.c
index a497a07d108101dddde62447124057a3c9a8c724..3ff5ef691a49dde95797f35232a846ef1092e67f 100644 (file)
@@ -20,7 +20,7 @@
  *
  */
 
-#include "internal.h"
+#include "busybox.h"
 #include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
@@ -38,14 +38,6 @@ struct kbentry {
 #define NR_KEYS         128
 #define MAX_NR_KEYMAPS  256
 
-
-static const char dumpkmap_usage[] = "dumpkmap\n"
-#ifndef BB_FEATURE_TRIVIAL_HELP
-       "\nPrints out a binary keyboard translation table to standard input.\n"
-#endif
-       ;
-
-
 int dumpkmap_main(int argc, char **argv)
 {
        struct kbentry ke;
@@ -58,8 +50,8 @@ int dumpkmap_main(int argc, char **argv)
 
        fd = open("/dev/tty0", O_RDWR);
        if (fd < 0) {
-               fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno));
-               return 1;
+               error_msg("Error opening /dev/tty0: %s\n", strerror(errno));
+               return EXIT_FAILURE;
        }
 
        write(1, magic, 7);
@@ -86,15 +78,15 @@ int dumpkmap_main(int argc, char **argv)
                                ke.kb_table = i;
                                if (ioctl(fd, KDGKBENT, &ke) < 0) {
                                
-                                       fprintf(stderr, "ioctl returned: %s, %s, %s, %xqq\n",strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value);
+                                       error_msg("ioctl returned: %s, %s, %s, %xqq\n",strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value);
                                        }
                                else {
-                                       write(1,&ke.kb_value,2);        
+                                       write(1,(void*)&ke.kb_value,2); 
                                        }       
                                
                        }
                }
        }
        close(fd);
-       return 0;
+       return EXIT_SUCCESS;
 }