Annotation of /trunk/mkinitrd-magellan/busybox/console-tools/setconsole.c
Parent Directory | Revision Log
Revision 816 -
(hide annotations)
(download)
Fri Apr 24 18:33:46 2009 UTC (15 years ago) by niro
File MIME type: text/plain
File size: 930 byte(s)
Fri Apr 24 18:33:46 2009 UTC (15 years ago) by niro
File MIME type: text/plain
File size: 930 byte(s)
-updated to busybox-1.13.4
1 | niro | 532 | /* vi: set sw=4 ts=4: */ |
2 | /* | ||
3 | * setconsole.c - redirect system console output | ||
4 | * | ||
5 | * Copyright (C) 2004,2005 Enrik Berkhan <Enrik.Berkhan@inka.de> | ||
6 | niro | 816 | * Copyright (C) 2008 Bernhard Reutner-Fischer |
7 | niro | 532 | * |
8 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | ||
9 | */ | ||
10 | |||
11 | niro | 816 | #include "libbb.h" |
12 | niro | 532 | |
13 | niro | 816 | int setconsole_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
14 | int setconsole_main(int argc UNUSED_PARAM, char **argv) | ||
15 | niro | 532 | { |
16 | const char *device = CURRENT_TTY; | ||
17 | niro | 816 | bool reset; |
18 | niro | 532 | |
19 | #if ENABLE_FEATURE_SETCONSOLE_LONG_OPTIONS | ||
20 | niro | 816 | static const char setconsole_longopts[] ALIGN1 = |
21 | "reset\0" No_argument "r" | ||
22 | ; | ||
23 | applet_long_options = setconsole_longopts; | ||
24 | niro | 532 | #endif |
25 | niro | 816 | /* at most one non-option argument */ |
26 | opt_complementary = "?1"; | ||
27 | reset = getopt32(argv, "r"); | ||
28 | niro | 532 | |
29 | niro | 816 | argv += 1 + reset; |
30 | if (*argv) { | ||
31 | device = *argv; | ||
32 | niro | 532 | } else { |
33 | niro | 816 | if (reset) |
34 | device = DEV_CONSOLE; | ||
35 | niro | 532 | } |
36 | |||
37 | niro | 816 | xioctl(xopen(device, O_RDONLY), TIOCCONS, NULL); |
38 | niro | 532 | return EXIT_SUCCESS; |
39 | } |