aboutsummaryrefslogtreecommitdiff
path: root/console-tools/setconsole.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2005-09-08 03:27:06 +0000
committerRob Landley <rob@landley.net>2005-09-08 03:27:06 +0000
commit9f0e00fc61858a0e3cc6711b78e95c57b484ef7c (patch)
treec7b8e35296501484d82d6ac84ae1685df3339ccb /console-tools/setconsole.c
parent230b411de87219f8a59e5d4061d7908cd44ed4d7 (diff)
downloadbusybox-w32-9f0e00fc61858a0e3cc6711b78e95c57b484ef7c.tar.gz
busybox-w32-9f0e00fc61858a0e3cc6711b78e95c57b484ef7c.tar.bz2
busybox-w32-9f0e00fc61858a0e3cc6711b78e95c57b484ef7c.zip
Tito sent more size tweaks.
Diffstat (limited to 'console-tools/setconsole.c')
-rw-r--r--console-tools/setconsole.c12
1 files changed, 4 insertions, 8 deletions
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}