summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--console-tools/chvt.c4
-rw-r--r--console-tools/deallocvt.c8
-rw-r--r--console-tools/openvt.c25
3 files changed, 14 insertions, 23 deletions
diff --git a/console-tools/chvt.c b/console-tools/chvt.c
index 252aed7..cba5b40 100644
--- a/console-tools/chvt.c
+++ b/console-tools/chvt.c
@@ -44,8 +44,8 @@ int chvt_main(int argc, char **argv)
fd = get_console_fd();
num = bb_xgetlarg(argv[1], 10, 0, INT_MAX);
- if((-1 == ioctl(fd, VT_ACTIVATE, num)) ||
- (-1 == ioctl(fd, VT_WAITACTIVE, num))) {
+ if ((-1 == ioctl(fd, VT_ACTIVATE, num))
+ || (-1 == ioctl(fd, VT_WAITACTIVE, num))) {
bb_perror_msg_and_die("ioctl");
}
return EXIT_SUCCESS;
diff --git a/console-tools/deallocvt.c b/console-tools/deallocvt.c
index ad3cebf..853b2b4 100644
--- a/console-tools/deallocvt.c
+++ b/console-tools/deallocvt.c
@@ -37,11 +37,11 @@ int deallocvt_main(int argc, char *argv[])
/* num = 0 deallocate all unused consoles */
int num = 0;
- switch(argc)
- {
+ switch (argc) {
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");
+ }
/* Fallthrough */
case 1:
break;
@@ -49,7 +49,7 @@ int deallocvt_main(int argc, char *argv[])
bb_show_usage();
}
- if (-1 == ioctl( get_console_fd(), VT_DISALLOCATE, num )) {
+ if (-1 == ioctl(get_console_fd(), VT_DISALLOCATE, num)) {
bb_perror_msg_and_die("VT_DISALLOCATE");
}
return EXIT_SUCCESS;
diff --git a/console-tools/openvt.c b/console-tools/openvt.c
index 6bdf608..de6a19f 100644
--- a/console-tools/openvt.c
+++ b/console-tools/openvt.c
@@ -35,28 +35,19 @@
int openvt_main(int argc, char **argv)
{
int fd;
- char vtname[sizeof VC_FORMAT + 2];
+ char vtname[sizeof(VC_FORMAT) + 2];
- if (argc < 3)
- bb_show_usage();
-
+ if (argc < 3) {
+ bb_show_usage();
+ }
/* check for Illegal vt number: < 1 or > 12 */
- sprintf(vtname, VC_FORMAT,(int)bb_xgetlarg(argv[1], 10, 1, 12));
-
- argv+=2;
- argc-=2;
+ sprintf(vtname, VC_FORMAT, (int)bb_xgetlarg(argv[1], 10, 1, 12));
- if(fork() == 0) {
+ if (fork() == 0) {
/* leave current vt */
-
-#ifdef ESIX_5_3_2_D
- if (setpgrp() < 0) {
-#else
if (setsid() < 0) {
-#endif
-
- bb_perror_msg_and_die("Unable to set new session");
+ bb_perror_msg_and_die("setsid");
}
close(0); /* so that new vt becomes stdin */
@@ -67,7 +58,7 @@ int openvt_main(int argc, char **argv)
dup2(fd, STDOUT_FILENO);
dup2(fd, STDERR_FILENO);
- execvp(argv[0], argv);
+ execvp(argv[2], &argv[2]);
_exit(1);
}
return EXIT_SUCCESS;