aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlandley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277>2005-09-08 03:27:06 +0000
committerlandley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277>2005-09-08 03:27:06 +0000
commit34fc9593c851077e268173538476ad31a8c6a0e5 (patch)
treec7b8e35296501484d82d6ac84ae1685df3339ccb
parente30c75afb85b0b70571d1550ff4eddbf3044becb (diff)
downloadbusybox-w32-34fc9593c851077e268173538476ad31a8c6a0e5.tar.gz
busybox-w32-34fc9593c851077e268173538476ad31a8c6a0e5.tar.bz2
busybox-w32-34fc9593c851077e268173538476ad31a8c6a0e5.zip
Tito sent more size tweaks.
git-svn-id: svn://busybox.net/trunk/busybox@11390 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r--console-tools/chvt.c8
-rw-r--r--console-tools/deallocvt.c4
-rw-r--r--console-tools/openvt.c6
-rw-r--r--console-tools/setconsole.c12
4 files changed, 11 insertions, 19 deletions
diff --git a/console-tools/chvt.c b/console-tools/chvt.c
index 3398892f5..b1a429eb3 100644
--- a/console-tools/chvt.c
+++ b/console-tools/chvt.c
@@ -42,11 +42,9 @@ int chvt_main(int argc, char **argv)
42 42
43 fd = get_console_fd(); 43 fd = get_console_fd();
44 num = bb_xgetlarg(argv[1], 10, 0, INT_MAX); 44 num = bb_xgetlarg(argv[1], 10, 0, INT_MAX);
45 if (ioctl(fd, VT_ACTIVATE, num)) { 45 if((-1 == ioctl(fd, VT_ACTIVATE, num)) ||
46 bb_perror_msg_and_die("VT_ACTIVATE"); 46 (-1 == ioctl(fd, VT_WAITACTIVE, num))) {
47 } 47 bb_perror_msg_and_die("ioctl");
48 if (ioctl(fd, VT_WAITACTIVE, num)) {
49 bb_perror_msg_and_die("VT_WAITACTIVE");
50 } 48 }
51 return EXIT_SUCCESS; 49 return EXIT_SUCCESS;
52} 50}
diff --git a/console-tools/deallocvt.c b/console-tools/deallocvt.c
index 08a9d2122..00ddf4236 100644
--- a/console-tools/deallocvt.c
+++ b/console-tools/deallocvt.c
@@ -42,14 +42,14 @@ int deallocvt_main(int argc, char *argv[])
42 case 2: 42 case 2:
43 if((num = bb_xgetlarg(argv[1], 10, 0, INT_MAX)) == 0) 43 if((num = bb_xgetlarg(argv[1], 10, 0, INT_MAX)) == 0)
44 bb_error_msg_and_die("0: illegal VT number"); 44 bb_error_msg_and_die("0: illegal VT number");
45 /* Falltrough */ 45 /* Fallthrough */
46 case 1: 46 case 1:
47 break; 47 break;
48 default: 48 default:
49 bb_show_usage(); 49 bb_show_usage();
50 } 50 }
51 51
52 if (ioctl( get_console_fd(), VT_DISALLOCATE, num )) { 52 if (-1 == ioctl( get_console_fd(), VT_DISALLOCATE, num )) {
53 bb_perror_msg_and_die("VT_DISALLOCATE"); 53 bb_perror_msg_and_die("VT_DISALLOCATE");
54 } 54 }
55 return EXIT_SUCCESS; 55 return EXIT_SUCCESS;
diff --git a/console-tools/openvt.c b/console-tools/openvt.c
index 5f244579c..d9f49bbea 100644
--- a/console-tools/openvt.c
+++ b/console-tools/openvt.c
@@ -64,10 +64,8 @@ int openvt_main(int argc, char **argv)
64 fd = bb_xopen(vtname, O_RDWR); 64 fd = bb_xopen(vtname, O_RDWR);
65 65
66 /* Reassign stdout and sterr */ 66 /* Reassign stdout and sterr */
67 close(1); 67 dup2(fd, STDOUT_FILENO);
68 close(2); 68 dup2(fd, STDERR_FILENO);
69 dup(fd);
70 dup(fd);
71 69
72 execvp(argv[0], argv); 70 execvp(argv[0], argv);
73 _exit(1); 71 _exit(1);
diff --git a/console-tools/setconsole.c b/console-tools/setconsole.c
index 53ff1ad1e..5806f21ed 100644
--- a/console-tools/setconsole.c
+++ b/console-tools/setconsole.c
@@ -37,9 +37,8 @@ static const struct option setconsole_long_options[] = {
37 37
38int setconsole_main(int argc, char **argv) 38int setconsole_main(int argc, char **argv)
39{ 39{
40 int con;
41 unsigned long flags; 40 unsigned long flags;
42 const char *device = "/dev/tty"; 41 const char *device = CURRENT_TTY;
43 42
44 bb_applet_long_options = setconsole_long_options; 43 bb_applet_long_options = setconsole_long_options;
45 flags = bb_getopt_ulflags(argc, argv, "r"); 44 flags = bb_getopt_ulflags(argc, argv, "r");
@@ -53,14 +52,11 @@ int setconsole_main(int argc, char **argv)
53 device = argv[optind]; 52 device = argv[optind];
54 } else { 53 } else {
55 if (flags & OPT_SETCONS_RESET) 54 if (flags & OPT_SETCONS_RESET)
56 device = "/dev/console"; 55 device = CONSOLE_DEV;
57 } 56 }
58 57
59 if (-1 == (con = open(device, O_RDONLY))) { 58 if (-1 == ioctl(bb_xopen(device, O_RDONLY), TIOCCONS)) {
60 bb_perror_msg_and_die("open %s", device); 59 bb_perror_msg_and_die("TIOCCONS");
61 }
62 if (-1 == ioctl(con, TIOCCONS)) {
63 bb_perror_msg_and_die("ioctl TIOCCONS");
64 } 60 }
65 return EXIT_SUCCESS; 61 return EXIT_SUCCESS;
66} 62}