9 |
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
10 |
*/ |
*/ |
11 |
|
|
12 |
#include "busybox.h" |
#include "libbb.h" |
13 |
|
|
14 |
extern int setlogcons_main(int argc, char **argv) |
int setlogcons_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
15 |
|
int setlogcons_main(int argc UNUSED_PARAM, char **argv) |
16 |
{ |
{ |
17 |
struct { |
struct { |
18 |
char fn; |
char fn; |
19 |
char subarg; |
char subarg; |
20 |
} arg; |
} arg = { 11, /* redirect kernel messages */ |
21 |
|
0 /* to specified console (current as default) */ |
22 |
|
}; |
23 |
|
|
24 |
arg.fn = 11; /* redirect kernel messages */ |
if (argv[1]) |
25 |
arg.subarg = 0; /* to specified console (current as default) */ |
arg.subarg = xatou_range(argv[1], 0, 63); |
26 |
|
|
27 |
if (argc == 2) |
xioctl(xopen(VC_1, O_RDONLY), TIOCLINUX, &arg); |
|
arg.subarg = xatoul_range(argv[1], 0, 63); |
|
28 |
|
|
29 |
if (ioctl(xopen(VC_1, O_RDONLY), TIOCLINUX, &arg)) |
return EXIT_SUCCESS; |
|
bb_perror_msg_and_die("TIOCLINUX"); |
|
|
|
|
|
return 0; |
|
30 |
} |
} |