1 /* vi: set sw=4 ts=4: */
3 * chvt.c - aeb - 940227 - Change virtual terminal
5 * busyboxed by Erik Andersen
8 /* getopt not needed */
13 #include <sys/types.h>
14 #include <sys/ioctl.h>
17 /* From <linux/vt.h> */
18 static const int VT_ACTIVATE = 0x5606; /* make vt active */
19 static const int VT_WAITACTIVE = 0x5607; /* wait for vt active */
21 int chvt_main(int argc, char **argv)
25 if ((argc != 2) || (**(argv + 1) == '-'))
27 fd = get_console_fd("/dev/console");
29 if (ioctl(fd, VT_ACTIVATE, num))
30 perror_msg_and_die("VT_ACTIVATE");
31 if (ioctl(fd, VT_WAITACTIVE, num))
32 perror_msg_and_die("VT_WAITACTIVE");