2 * disalloc.c - aeb - 940501 - Disallocate virtual terminal(s)
10 #include <sys/ioctl.h>
17 main(int argc, char *argv[]) {
20 if (argc < 1) /* unlikely */
22 set_progname(argv[0]);
24 setlocale(LC_ALL, "");
25 bindtextdomain(PACKAGE, LOCALEDIR);
28 if (argc == 2 && !strcmp(argv[1], "-V"))
29 print_version_and_exit();
31 for (i = 1; i < argc; i++) {
32 if (!isdigit(argv[i][0])) {
33 fprintf(stderr, _("%s: unknown option\n"), progname);
41 /* deallocate all unused consoles */
42 if (ioctl(fd,VT_DISALLOCATE,0)) {
43 perror("VT_DISALLOCATE");
45 _("%s: deallocating all unused consoles failed\n"),
49 } else for (i = 1; i < argc; i++) {
53 _("%s: 0: illegal VT number\n"), progname);
55 } else if (num == 1) {
57 _("%s: VT 1 is the console and cannot be deallocated\n"),
60 } else if (ioctl(fd,VT_DISALLOCATE,num)) {
61 perror("VT_DISALLOCATE");
63 _("%s: could not deallocate console %d\n"),