mirror of
https://github.com/sheumann/hush.git
synced 2025-01-02 09:31:26 +00:00
Tito sent more size tweaks.
This commit is contained in:
parent
230b411de8
commit
9f0e00fc61
@ -42,11 +42,9 @@ int chvt_main(int argc, char **argv)
|
|||||||
|
|
||||||
fd = get_console_fd();
|
fd = get_console_fd();
|
||||||
num = bb_xgetlarg(argv[1], 10, 0, INT_MAX);
|
num = bb_xgetlarg(argv[1], 10, 0, INT_MAX);
|
||||||
if (ioctl(fd, VT_ACTIVATE, num)) {
|
if((-1 == ioctl(fd, VT_ACTIVATE, num)) ||
|
||||||
bb_perror_msg_and_die("VT_ACTIVATE");
|
(-1 == ioctl(fd, VT_WAITACTIVE, num))) {
|
||||||
}
|
bb_perror_msg_and_die("ioctl");
|
||||||
if (ioctl(fd, VT_WAITACTIVE, num)) {
|
|
||||||
bb_perror_msg_and_die("VT_WAITACTIVE");
|
|
||||||
}
|
}
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -42,14 +42,14 @@ int deallocvt_main(int argc, char *argv[])
|
|||||||
case 2:
|
case 2:
|
||||||
if((num = bb_xgetlarg(argv[1], 10, 0, INT_MAX)) == 0)
|
if((num = bb_xgetlarg(argv[1], 10, 0, INT_MAX)) == 0)
|
||||||
bb_error_msg_and_die("0: illegal VT number");
|
bb_error_msg_and_die("0: illegal VT number");
|
||||||
/* Falltrough */
|
/* Fallthrough */
|
||||||
case 1:
|
case 1:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
bb_show_usage();
|
bb_show_usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ioctl( get_console_fd(), VT_DISALLOCATE, num )) {
|
if (-1 == ioctl( get_console_fd(), VT_DISALLOCATE, num )) {
|
||||||
bb_perror_msg_and_die("VT_DISALLOCATE");
|
bb_perror_msg_and_die("VT_DISALLOCATE");
|
||||||
}
|
}
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
@ -64,10 +64,8 @@ int openvt_main(int argc, char **argv)
|
|||||||
fd = bb_xopen(vtname, O_RDWR);
|
fd = bb_xopen(vtname, O_RDWR);
|
||||||
|
|
||||||
/* Reassign stdout and sterr */
|
/* Reassign stdout and sterr */
|
||||||
close(1);
|
dup2(fd, STDOUT_FILENO);
|
||||||
close(2);
|
dup2(fd, STDERR_FILENO);
|
||||||
dup(fd);
|
|
||||||
dup(fd);
|
|
||||||
|
|
||||||
execvp(argv[0], argv);
|
execvp(argv[0], argv);
|
||||||
_exit(1);
|
_exit(1);
|
||||||
|
@ -37,9 +37,8 @@ static const struct option setconsole_long_options[] = {
|
|||||||
|
|
||||||
int setconsole_main(int argc, char **argv)
|
int setconsole_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int con;
|
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
const char *device = "/dev/tty";
|
const char *device = CURRENT_TTY;
|
||||||
|
|
||||||
bb_applet_long_options = setconsole_long_options;
|
bb_applet_long_options = setconsole_long_options;
|
||||||
flags = bb_getopt_ulflags(argc, argv, "r");
|
flags = bb_getopt_ulflags(argc, argv, "r");
|
||||||
@ -53,14 +52,11 @@ int setconsole_main(int argc, char **argv)
|
|||||||
device = argv[optind];
|
device = argv[optind];
|
||||||
} else {
|
} else {
|
||||||
if (flags & OPT_SETCONS_RESET)
|
if (flags & OPT_SETCONS_RESET)
|
||||||
device = "/dev/console";
|
device = CONSOLE_DEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-1 == (con = open(device, O_RDONLY))) {
|
if (-1 == ioctl(bb_xopen(device, O_RDONLY), TIOCCONS)) {
|
||||||
bb_perror_msg_and_die("open %s", device);
|
bb_perror_msg_and_die("TIOCCONS");
|
||||||
}
|
|
||||||
if (-1 == ioctl(con, TIOCCONS)) {
|
|
||||||
bb_perror_msg_and_die("ioctl TIOCCONS");
|
|
||||||
}
|
}
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user