mirror of
https://github.com/topjohnwu/ndk-busybox.git
synced 2025-02-27 07:35:33 +00:00
A couple of patches from Tito <farmatito@tiscali.it>
This commit is contained in:
parent
7a54360cd4
commit
a860bec167
@ -15,29 +15,32 @@ static const int VT_DISALLOCATE = 0x5608; /* free memory associated to vt */
|
|||||||
|
|
||||||
int deallocvt_main(int argc, char *argv[])
|
int deallocvt_main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int fd, num, i;
|
int fd, num=0;
|
||||||
|
|
||||||
//if ((argc > 2) || ((argv == 2) && (**(argv + 1) == '-')))
|
|
||||||
if (argc > 2)
|
if (argc > 2)
|
||||||
bb_show_usage();
|
bb_show_usage();
|
||||||
|
|
||||||
fd = get_console_fd();
|
fd = get_console_fd();
|
||||||
|
|
||||||
|
/* num=0 deallocate all unused consoles */
|
||||||
|
if (argc == 1)
|
||||||
|
goto disallocate_all;
|
||||||
|
|
||||||
if (argc == 1) {
|
num=bb_xgetlarg(argv[1], 10, 0, INT_MAX);
|
||||||
/* deallocate all unused consoles */
|
|
||||||
if (ioctl(fd, VT_DISALLOCATE, 0))
|
switch(num)
|
||||||
bb_perror_msg_and_die("VT_DISALLOCATE");
|
{
|
||||||
} else {
|
case 0:
|
||||||
for (i = 1; i < argc; i++) {
|
bb_error_msg("0: illegal VT number");
|
||||||
num = atoi(argv[i]);
|
break;
|
||||||
if (num == 0)
|
case 1:
|
||||||
bb_error_msg("0: illegal VT number");
|
bb_error_msg("VT 1 cannot be deallocated");
|
||||||
else if (num == 1)
|
break;
|
||||||
bb_error_msg("VT 1 cannot be deallocated");
|
default:
|
||||||
else if (ioctl(fd, VT_DISALLOCATE, num))
|
disallocate_all:
|
||||||
|
if (ioctl(fd, VT_DISALLOCATE, num))
|
||||||
bb_perror_msg_and_die("VT_DISALLOCATE");
|
bb_perror_msg_and_die("VT_DISALLOCATE");
|
||||||
}
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
return EXIT_FAILURE;
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ int strings_main(int argc, char **argv)
|
|||||||
opt+=2;
|
opt+=2;
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
n = bb_xgetlarg(optarg, 10, 1, LONG_MAX);
|
n = bb_xgetlarg(optarg, 10, 1, INT_MAX);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
bb_show_usage();
|
bb_show_usage();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user