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