aboutsummaryrefslogtreecommitdiff
path: root/console-tools
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>1999-10-25 23:32:44 +0000
committerEric Andersen <andersen@codepoet.org>1999-10-25 23:32:44 +0000
commit0460ff2e5d443b485c2f6447c8c2ece1b3bec9c3 (patch)
treed761a790ee864a0a566d29c9d56173763fa04888 /console-tools
parentd143e8f2bd03470e891a5e3ccca5734edd917e73 (diff)
downloadbusybox-w32-0460ff2e5d443b485c2f6447c8c2ece1b3bec9c3.tar.gz
busybox-w32-0460ff2e5d443b485c2f6447c8c2ece1b3bec9c3.tar.bz2
busybox-w32-0460ff2e5d443b485c2f6447c8c2ece1b3bec9c3.zip
Stuf
Diffstat (limited to 'console-tools')
-rw-r--r--console-tools/chvt.c36
-rw-r--r--console-tools/deallocvt.c47
2 files changed, 83 insertions, 0 deletions
diff --git a/console-tools/chvt.c b/console-tools/chvt.c
new file mode 100644
index 000000000..81d199527
--- /dev/null
+++ b/console-tools/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
diff --git a/console-tools/deallocvt.c b/console-tools/deallocvt.c
new file mode 100644
index 000000000..a8feeb53c
--- /dev/null
+++ b/console-tools/deallocvt.c
@@ -0,0 +1,47 @@
1/*
2 * disalloc.c - aeb - 940501 - Disallocate virtual terminal(s)
3 * Renamed deallocvt.
4 */
5#include <stdlib.h>
6#include <fcntl.h>
7#include <sys/types.h>
8#include <sys/ioctl.h>
9#include <linux/vt.h>
10#include <stdio.h>
11
12extern int getfd(void);
13char *progname;
14
15int
16deallocvt_main(int argc, char *argv[]) {
17 int fd, num, i;
18
19 if (argc < 1) /* unlikely */
20 exit(1);
21 progname = argv[0];
22
23 fd = get_console_fd("/dev/console");
24
25 if (argc == 1) {
26 /* deallocate all unused consoles */
27 if (ioctl(fd,VT_DISALLOCATE,0)) {
28 perror("VT_DISALLOCATE");
29 exit(1);
30 }
31 } else
32 for (i = 1; i < argc; i++) {
33 num = atoi(argv[i]);
34 if (num == 0)
35 fprintf(stderr, "%s: 0: illegal VT number\n", progname);
36 else if (num == 1)
37 fprintf(stderr, "%s: VT 1 cannot be deallocated\n", progname);
38 else
39 if (ioctl(fd,VT_DISALLOCATE,num)) {
40 perror("VT_DISALLOCATE");
41 fprintf(stderr, "%s: could not deallocate console %d\n",
42 progname, num);
43 exit(1);
44 }
45 }
46 exit(0);
47}