1 /* vi: set sw=4 ts=4: */
3 * disalloc.c - aeb - 940501 - Disallocate virtual terminal(s)
10 #include <sys/ioctl.h>
14 extern int getfd(void);
17 int deallocvt_main(int argc, char *argv[])
21 if ((argc != 2) || (**(argv + 1) == '-')) {
23 ("deallocvt N\n\nDeallocate unused virtual terminal /dev/ttyN\n");
28 fd = get_console_fd("/dev/console");
31 /* deallocate all unused consoles */
32 if (ioctl(fd, VT_DISALLOCATE, 0)) {
33 perror("VT_DISALLOCATE");
37 for (i = 1; i < argc; i++) {
40 fprintf(stderr, "%s: 0: illegal VT number\n", progname);
42 fprintf(stderr, "%s: VT 1 cannot be deallocated\n",
44 else if (ioctl(fd, VT_DISALLOCATE, num)) {
45 perror("VT_DISALLOCATE");
46 fprintf(stderr, "%s: could not deallocate console %d\n",