Add pancyrillic font
[platform/upstream/kbd.git] / src / spawn_login.c
1 /*
2  * Tiny test program for the `spawn console' key
3  * (should not use signal; should not use sleep)
4  * aeb - 941025
5  *
6  */
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <signal.h>
10 #include <errno.h>
11 #include <unistd.h>
12 #include <fcntl.h>
13 #include <sys/ioctl.h>
14 #include <linux/kd.h>
15
16 #include "kbd.h"
17
18 static void
19 sighup(int n __attribute__ ((unused))) {
20     if (system("openvt -s -l -- login -h spawn") == -1) {
21         perror("system");
22         exit(1);
23     }
24     signal(SIGHUP, sighup);
25 }
26
27 int
28 main(void) {
29     int fd;
30
31     fd = open("/dev/tty0", 0);
32     if (fd < 0 && errno == ENOENT)
33       fd = open("/dev/vc/0", 0);
34     if (fd < 0)
35       fd = 0;
36     signal(SIGHUP, sighup);
37     ioctl(fd, KDSIGACCEPT, (long) SIGHUP);
38     while(1)
39       sleep(3600);
40 }