Imported Upstream version 2.0.3_rc1
[platform/upstream/kbd.git] / src / totextmode.c
1 /*
2  * totextmode.c - aeb - 2000-01-20
3  */
4 #include <stdlib.h>
5 #include <sys/types.h>
6 #include <sys/ioctl.h>
7 #include <linux/vt.h>
8 #include <linux/kd.h>
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <fcntl.h>
12 #include "getfd.h"
13 #include "nls.h"
14 #include "version.h"
15 #include "kbd_error.h"
16
17 int
18 main(int argc, char *argv[]) {
19         int fd, num;
20
21         set_progname(argv[0]);
22
23         setlocale(LC_ALL, "");
24         bindtextdomain(PACKAGE_NAME, LOCALEDIR);
25         textdomain(PACKAGE_NAME);
26
27         if (argc == 2 && !strcmp(argv[1], "-V"))
28                 print_version_and_exit();
29
30         if (argc != 2) {
31                 kbd_error(EXIT_FAILURE, 0, _("usage: totextmode\n"));
32         }
33         fd = getfd(NULL);
34         num = atoi(argv[1]);
35         if (ioctl(fd,KDSETMODE,KD_TEXT)) {
36                 kbd_error(EXIT_FAILURE, errno, "totextmode: KDSETMODE");
37         }
38         return EXIT_SUCCESS;
39 }