Imported Upstream version 2.0.90
[platform/upstream/kbd.git] / src / clrunimap.c
index 74c9311..feddc4e 100644 (file)
@@ -3,6 +3,7 @@
  *
  * Note: nowadays this kills kernel console output!
  */
+#include "config.h"
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <linux/kd.h>
 #include "kdmapop.h"
-#include "getfd.h"
-#include "nls.h"
 
-int
-main(int argc, char *argv[]) {
+#include "libcommon.h"
+
+int main(int argc, char *argv[])
+{
        int fd;
        char *console = NULL;
 
-#ifndef __klibc__
-       setlocale(LC_ALL, "");
-       bindtextdomain(PACKAGE_NAME, LOCALEDIR);
-       textdomain(PACKAGE_NAME);
-#endif
+       set_progname(argv[0]);
+       setuplocale();
 
        if (argc >= 3 && !strcmp(argv[1], "-C"))
                console = argv[2];
 
-       fd = getfd(console);
+       if ((fd = getfd(console)) < 0)
+               kbd_error(EXIT_FAILURE, 0, _("Couldn't get a file descriptor referring to the console"));
 
-       return loadunimap (fd, NULL, NULL);
+       return loadunimap(fd, NULL, NULL);
 }