diff --git a/Makefile b/Makefile index 6112ddd..3c4840d 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,6 @@ SRC = \ chmod.c \ chown.c \ chroot.c \ - chvt.c \ cksum.c \ cmp.c \ comm.c \ diff --git a/chvt.1 b/chvt.1 deleted file mode 100644 index c52082c..0000000 --- a/chvt.1 +++ /dev/null @@ -1,11 +0,0 @@ -.TH CHVT 1 sbase\-VERSION -.SH NAME -chvt \- change foreground virtual terminal -.SH SYNOPSIS -.B chvt -.I N -.SH DESCRIPTION -.B chvt -brings /dev/ttyN to the foreground. This has the -same effect as Ctrl-Alt-FN. - diff --git a/chvt.c b/chvt.c deleted file mode 100644 index fd76cb1..0000000 --- a/chvt.c +++ /dev/null @@ -1,61 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include "util.h" - -enum { - /* from */ - VT_ACTIVATE = 0x5606, - VT_WAITACTIVE = 0x5607, - /* from */ - KDGKBTYPE = 0x4B33 -}; - -char *vts[] = { - "/proc/self/fd/0", - "/dev/console", - "/dev/tty", - "/dev/tty0", -}; - -static void -usage(void) -{ - eprintf("usage: chvt N\n"); -} - -int -main(int argc, char **argv) -{ - int n, i, fd; - char c; - - if(argc!=2 || strspn(argv[1], "1234567890") != strlen(argv[1])) - usage(); - - n = atoi(argv[1]); - for(i = 0; i < LEN(vts); i++) { - fd = open(vts[i], O_RDONLY); - if(fd < 1) - continue; - c = 0; - if(ioctl(fd, KDGKBTYPE, &c) == 0) - goto VTfound; - close(fd); - } - - eprintf("chvt: couldn't find a console.\n"); -VTfound: - if(ioctl(fd, VT_ACTIVATE, n) == -1) - eprintf("chvt: VT_ACTIVATE '%d':", n); - if(ioctl(fd, VT_WAITACTIVE, n) == -1) - eprintf("chvt: VT_WAITACTIVE '%d':", n); - close(fd); - - return 0; -} -