aboutsummaryrefslogtreecommitdiff
path: root/chvt.c
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>1999-10-25 23:32:44 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>1999-10-25 23:32:44 +0000
commit3c2381e1dc71b30c5511f8142ea271328e15c2dd (patch)
treed761a790ee864a0a566d29c9d56173763fa04888 /chvt.c
parentfbf5a726a6bc6f126c04c7949fe5820b37583530 (diff)
downloadbusybox-w32-3c2381e1dc71b30c5511f8142ea271328e15c2dd.tar.gz
busybox-w32-3c2381e1dc71b30c5511f8142ea271328e15c2dd.tar.bz2
busybox-w32-3c2381e1dc71b30c5511f8142ea271328e15c2dd.zip
Stuf
git-svn-id: svn://busybox.net/trunk/busybox@59 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'chvt.c')
-rw-r--r--chvt.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/chvt.c b/chvt.c
new file mode 100644
index 000000000..81d199527
--- /dev/null
+++ b/chvt.c
@@ -0,0 +1,36 @@
1/*
2 * chvt.c - aeb - 940227 - Change virtual terminal
3 *
4 * busyboxed by Erik Andersen
5 */
6#include "internal.h"
7#include <sys/types.h>
8#include <sys/ioctl.h>
9#include <linux/vt.h>
10#include <stdio.h>
11#include <stdlib.h>
12#include <fcntl.h>
13
14extern int getfd(void);
15
16int
17chvt_main(int argc, char** argv)
18{
19 int fd, num;
20
21 if ( ( argc != 2) || (**(argv+1) == '-' ) ) {
22 usage ("chvt </dev/ttyN>\n");
23 }
24 fd = get_console_fd("/dev/console");
25 num = atoi(argv[1]);
26 if (ioctl(fd,VT_ACTIVATE,num)) {
27 perror("VT_ACTIVATE");
28 exit(FALSE);
29 }
30 if (ioctl(fd,VT_WAITACTIVE,num)) {
31 perror("VT_WAITACTIVE");
32 exit(FALSE);
33 }
34 exit( TRUE);
35}
36