2 * Tiny test program for the `spawn console' key
3 * (should not use signal; should not use sleep)
15 #include <sys/ioctl.h>
20 #include "kbd_error.h"
23 sighup(int n __attribute__((unused)))
25 if (system("openvt -s -l -- login -h spawn") == -1) {
26 kbd_error(EXIT_FAILURE, errno, "system");
28 signal(SIGHUP, sighup);
31 int main(int argc __attribute__((unused)), char *argv[])
35 set_progname(argv[0]);
37 fd = open("/dev/tty0", 0);
38 if (fd < 0 && errno == ENOENT)
39 fd = open("/dev/vc/0", 0);
42 signal(SIGHUP, sighup);
43 if (ioctl(fd, KDSIGACCEPT, (long)SIGHUP))
44 kbd_error(EXIT_FAILURE, errno, "ioctl KDSIGACCEPT");