aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--console-tools/setconsole.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/console-tools/setconsole.c b/console-tools/setconsole.c
index 9a8ca3821..8f4b7b7a6 100644
--- a/console-tools/setconsole.c
+++ b/console-tools/setconsole.c
@@ -12,8 +12,10 @@
12//config: default y 12//config: default y
13//config: select PLATFORM_LINUX 13//config: select PLATFORM_LINUX
14//config: help 14//config: help
15//config: This program redirects the system console to another device, 15//config: Redirect writes to /dev/console to another device,
16//config: like the current tty while logged in via telnet. 16//config: like the current tty while logged in via telnet.
17//config: This does not redirect kernel log, only writes
18//config: from user space.
17//config: 19//config:
18//config:config FEATURE_SETCONSOLE_LONG_OPTIONS 20//config:config FEATURE_SETCONSOLE_LONG_OPTIONS
19//config: bool "Enable long options" 21//config: bool "Enable long options"
@@ -27,8 +29,10 @@
27//usage:#define setconsole_trivial_usage 29//usage:#define setconsole_trivial_usage
28//usage: "[-r] [DEVICE]" 30//usage: "[-r] [DEVICE]"
29//usage:#define setconsole_full_usage "\n\n" 31//usage:#define setconsole_full_usage "\n\n"
30//usage: "Redirect system console output to DEVICE (default: /dev/tty)\n" 32//usage: "Make writes to /dev/console appear on DEVICE (default: /dev/tty)."
31//usage: "\n -r Reset output to /dev/console" 33//usage: "\n""Does not redirect kernel log output or reads from /dev/console."
34//usage: "\n"
35//usage: "\n"" -r Reset: writes to /dev/console go to kernel log tty(s)"
32 36
33/* It was a bbox-specific invention, but SUSE does have a similar utility. 37/* It was a bbox-specific invention, but SUSE does have a similar utility.
34 * SUSE has no -r option, though. 38 * SUSE has no -r option, though.
@@ -40,7 +44,7 @@ int setconsole_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
40int setconsole_main(int argc UNUSED_PARAM, char **argv) 44int setconsole_main(int argc UNUSED_PARAM, char **argv)
41{ 45{
42 const char *device = CURRENT_TTY; 46 const char *device = CURRENT_TTY;
43 bool reset; 47 int reset;
44 48
45 /* at most one non-option argument */ 49 /* at most one non-option argument */
46 opt_complementary = "?1"; 50 opt_complementary = "?1";
@@ -54,6 +58,9 @@ int setconsole_main(int argc UNUSED_PARAM, char **argv)
54 device = DEV_CONSOLE; 58 device = DEV_CONSOLE;
55 } 59 }
56 60
61//TODO: fails if TIOCCONS redir is already active to some tty.
62//I think SUSE version first does TIOCCONS on /dev/console fd (iow: resets)
63//then TIOCCONS to new tty?
57 xioctl(xopen(device, O_WRONLY), TIOCCONS, NULL); 64 xioctl(xopen(device, O_WRONLY), TIOCCONS, NULL);
58 return EXIT_SUCCESS; 65 return EXIT_SUCCESS;
59} 66}