1 /* vi: set sw=4 ts=4: */
3 * disalloc.c - aeb - 940501 - Disallocate virtual terminal(s)
10 #include <sys/ioctl.h>
16 int deallocvt_main(int argc, char *argv[])
20 if ((argc != 2) || (**(argv + 1) == '-')) {
23 #ifndef BB_FEATURE_TRIVIAL_HELP
24 "\nDeallocate unused virtual terminal /dev/ttyN\n"
31 fd = get_console_fd("/dev/console");
34 /* deallocate all unused consoles */
35 if (ioctl(fd, VT_DISALLOCATE, 0)) {
36 perror("VT_DISALLOCATE");
40 for (i = 1; i < argc; i++) {
43 fprintf(stderr, "%s: 0: illegal VT number\n", progname);
45 fprintf(stderr, "%s: VT 1 cannot be deallocated\n",
47 else if (ioctl(fd, VT_DISALLOCATE, num)) {
48 perror("VT_DISALLOCATE");
49 fprintf(stderr, "%s: could not deallocate console %d\n",