diff options
Diffstat (limited to 'console-tools/deallocvt.c')
-rw-r--r-- | console-tools/deallocvt.c | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/console-tools/deallocvt.c b/console-tools/deallocvt.c index f641be8d7..b89249b87 100644 --- a/console-tools/deallocvt.c +++ b/console-tools/deallocvt.c | |||
@@ -1,8 +1,27 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | 1 | /* vi: set sw=4 ts=4: */ |
2 | /* | 2 | /* |
3 | * disalloc.c - aeb - 940501 - Disallocate virtual terminal(s) | 3 | * Disallocate virtual terminal(s) |
4 | * Renamed deallocvt. | 4 | * |
5 | * Copyright (C) 2003 by Tito Ragusa <farmatito@tiscali.it> | ||
6 | * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
5 | */ | 21 | */ |
22 | |||
23 | /* no options, no getopt */ | ||
24 | |||
6 | #include <stdlib.h> | 25 | #include <stdlib.h> |
7 | #include <stdio.h> | 26 | #include <stdio.h> |
8 | #include <fcntl.h> | 27 | #include <fcntl.h> |
@@ -15,21 +34,21 @@ static const int VT_DISALLOCATE = 0x5608; /* free memory associated to vt */ | |||
15 | 34 | ||
16 | int deallocvt_main(int argc, char *argv[]) | 35 | int deallocvt_main(int argc, char *argv[]) |
17 | { | 36 | { |
18 | int fd, num=0; | 37 | int fd, num = 0; |
19 | 38 | ||
20 | if (argc > 2) | 39 | if (argc > 2) { |
21 | bb_show_usage(); | 40 | bb_show_usage(); |
41 | } | ||
22 | 42 | ||
23 | fd = get_console_fd(); | 43 | fd = get_console_fd(); |
24 | 44 | ||
25 | /* num=0 deallocate all unused consoles */ | 45 | /* num=0 deallocate all unused consoles */ |
26 | if (argc == 1) | 46 | if (argc == 1) { |
27 | goto disallocate_all; | 47 | goto disallocate_all; |
48 | } | ||
28 | 49 | ||
29 | num=bb_xgetlarg(argv[1], 10, 0, INT_MAX); | 50 | num = bb_xgetlarg(argv[1], 10, 0, INT_MAX); |
30 | 51 | switch (num) { | |
31 | switch(num) | ||
32 | { | ||
33 | case 0: | 52 | case 0: |
34 | bb_error_msg("0: illegal VT number"); | 53 | bb_error_msg("0: illegal VT number"); |
35 | break; | 54 | break; |
@@ -38,8 +57,9 @@ int deallocvt_main(int argc, char *argv[]) | |||
38 | break; | 57 | break; |
39 | default: | 58 | default: |
40 | disallocate_all: | 59 | disallocate_all: |
41 | if (ioctl(fd, VT_DISALLOCATE, num)) | 60 | if (ioctl(fd, VT_DISALLOCATE, num)) { |
42 | bb_perror_msg_and_die("VT_DISALLOCATE"); | 61 | bb_perror_msg_and_die("VT_DISALLOCATE"); |
62 | } | ||
43 | return EXIT_SUCCESS; | 63 | return EXIT_SUCCESS; |
44 | } | 64 | } |
45 | return EXIT_FAILURE; | 65 | return EXIT_FAILURE; |