summaryrefslogtreecommitdiffhomepage
path: root/console-tools
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-03-10 23:16:25 +0000
committerRob Landley <rob@landley.net>2006-03-10 23:16:25 +0000
commitead19306f5d6d5d5ef49165aa518e525de8e84b2 (patch)
tree50e2c88bee71b9c4da3b54f951d337c112a85c03 /console-tools
parentbc68cd14ccaebc17e7e03a08e51fddfb91007624 (diff)
Cleanup patches from tito.
Diffstat (limited to 'console-tools')
-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 252aed740..cba5b4014 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 ad3cebfef..853b2b489 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 6bdf608c7..de6a19fbc 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;