aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-04-27 10:42:31 +0000
committerEric Andersen <andersen@codepoet.org>2003-04-27 10:42:31 +0000
commita860bec167faa960231b7f3c1ca55a49cda5a9d2 (patch)
tree134a61e4bc83baa7dcd554e58cb1b4ad6199a5c0
parent7a54360cd4130f5891e178b6d33eb5b15398c721 (diff)
downloadbusybox-w32-a860bec167faa960231b7f3c1ca55a49cda5a9d2.tar.gz
busybox-w32-a860bec167faa960231b7f3c1ca55a49cda5a9d2.tar.bz2
busybox-w32-a860bec167faa960231b7f3c1ca55a49cda5a9d2.zip
A couple of patches from Tito <farmatito@tiscali.it>
-rw-r--r--console-tools/deallocvt.c37
-rw-r--r--miscutils/strings.c2
2 files changed, 21 insertions, 18 deletions
diff --git a/console-tools/deallocvt.c b/console-tools/deallocvt.c
index a4ba851c8..f641be8d7 100644
--- a/console-tools/deallocvt.c
+++ b/console-tools/deallocvt.c
@@ -15,29 +15,32 @@ static const int VT_DISALLOCATE = 0x5608; /* free memory associated to vt */
15 15
16int deallocvt_main(int argc, char *argv[]) 16int deallocvt_main(int argc, char *argv[])
17{ 17{
18 int fd, num, i; 18 int fd, num=0;
19 19
20 //if ((argc > 2) || ((argv == 2) && (**(argv + 1) == '-')))
21 if (argc > 2) 20 if (argc > 2)
22 bb_show_usage(); 21 bb_show_usage();
23 22
24 fd = get_console_fd(); 23 fd = get_console_fd();
24
25 /* num=0 deallocate all unused consoles */
26 if (argc == 1)
27 goto disallocate_all;
25 28
26 if (argc == 1) { 29 num=bb_xgetlarg(argv[1], 10, 0, INT_MAX);
27 /* deallocate all unused consoles */ 30
28 if (ioctl(fd, VT_DISALLOCATE, 0)) 31 switch(num)
29 bb_perror_msg_and_die("VT_DISALLOCATE"); 32 {
30 } else { 33 case 0:
31 for (i = 1; i < argc; i++) { 34 bb_error_msg("0: illegal VT number");
32 num = atoi(argv[i]); 35 break;
33 if (num == 0) 36 case 1:
34 bb_error_msg("0: illegal VT number"); 37 bb_error_msg("VT 1 cannot be deallocated");
35 else if (num == 1) 38 break;
36 bb_error_msg("VT 1 cannot be deallocated"); 39 default:
37 else if (ioctl(fd, VT_DISALLOCATE, num)) 40disallocate_all:
41 if (ioctl(fd, VT_DISALLOCATE, num))
38 bb_perror_msg_and_die("VT_DISALLOCATE"); 42 bb_perror_msg_and_die("VT_DISALLOCATE");
39 } 43 return EXIT_SUCCESS;
40 } 44 }
41 45 return EXIT_FAILURE;
42 return EXIT_SUCCESS;
43} 46}
diff --git a/miscutils/strings.c b/miscutils/strings.c
index 2413c3f2d..c0d4a3f74 100644
--- a/miscutils/strings.c
+++ b/miscutils/strings.c
@@ -54,7 +54,7 @@ int strings_main(int argc, char **argv)
54 opt+=2; 54 opt+=2;
55 break; 55 break;
56 case 'n': 56 case 'n':
57 n = bb_xgetlarg(optarg, 10, 1, LONG_MAX); 57 n = bb_xgetlarg(optarg, 10, 1, INT_MAX);
58 break; 58 break;
59 default: 59 default:
60 bb_show_usage(); 60 bb_show_usage();