diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-05-19 08:18:50 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-05-19 08:18:50 +0000 |
commit | ae4342ca3e30f7b11732ecda3ad15821e81bc314 (patch) | |
tree | 1878104940eac4649bc8add4d0b2893ab1cb0a94 /console-tools/setconsole.c | |
parent | ee56e013cfb6304f66129afee7978b0864699419 (diff) | |
download | busybox-w32-ae4342ca3e30f7b11732ecda3ad15821e81bc314.tar.gz busybox-w32-ae4342ca3e30f7b11732ecda3ad15821e81bc314.tar.bz2 busybox-w32-ae4342ca3e30f7b11732ecda3ad15821e81bc314.zip |
- Rename getpty() to xgetpty() and adjust callers.
- Rewrite kbd_mode and setconsole
- Introduce and use console_make_active() and xopen_xwrite_close()
- honour buffer-reservation method as set by the user (dumpkmap, loadkmap)
- shrink rtcwake and some console-tools
Saves about 270 Bytes
Diffstat (limited to 'console-tools/setconsole.c')
-rw-r--r-- | console-tools/setconsole.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/console-tools/setconsole.c b/console-tools/setconsole.c index 8765a7c2e..82fe83f22 100644 --- a/console-tools/setconsole.c +++ b/console-tools/setconsole.c | |||
@@ -3,40 +3,34 @@ | |||
3 | * setconsole.c - redirect system console output | 3 | * setconsole.c - redirect system console output |
4 | * | 4 | * |
5 | * Copyright (C) 2004,2005 Enrik Berkhan <Enrik.Berkhan@inka.de> | 5 | * Copyright (C) 2004,2005 Enrik Berkhan <Enrik.Berkhan@inka.de> |
6 | * Copyright (C) 2008 Bernhard Fischer | ||
6 | * | 7 | * |
7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | 8 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
8 | */ | 9 | */ |
9 | 10 | ||
10 | #include "libbb.h" | 11 | #include "libbb.h" |
11 | 12 | ||
12 | #if ENABLE_FEATURE_SETCONSOLE_LONG_OPTIONS | ||
13 | static const char setconsole_longopts[] ALIGN1 = | ||
14 | "reset\0" No_argument "r" | ||
15 | ; | ||
16 | #endif | ||
17 | |||
18 | #define OPT_SETCONS_RESET 1 | ||
19 | |||
20 | int setconsole_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 13 | int setconsole_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
21 | int setconsole_main(int argc, char **argv) | 14 | int setconsole_main(int ATTRIBUTE_UNUSED argc, char **argv) |
22 | { | 15 | { |
23 | unsigned long flags; | ||
24 | const char *device = CURRENT_TTY; | 16 | const char *device = CURRENT_TTY; |
17 | bool reset; | ||
25 | 18 | ||
26 | #if ENABLE_FEATURE_SETCONSOLE_LONG_OPTIONS | 19 | #if ENABLE_FEATURE_SETCONSOLE_LONG_OPTIONS |
20 | static const char setconsole_longopts[] ALIGN1 = | ||
21 | "reset\0" No_argument "r" | ||
22 | ; | ||
27 | applet_long_options = setconsole_longopts; | 23 | applet_long_options = setconsole_longopts; |
28 | #endif | 24 | #endif |
29 | flags = getopt32(argv, "r"); | 25 | /* at most one non-option argument */ |
30 | 26 | opt_complementary = "?1"; | |
31 | if (argc - optind > 1) | 27 | reset = getopt32(argv, "r"); |
32 | bb_show_usage(); | ||
33 | 28 | ||
34 | if (argc - optind == 1) { | 29 | argv += 1 + reset; |
35 | if (flags & OPT_SETCONS_RESET) | 30 | if (*argv) { |
36 | bb_show_usage(); | 31 | device = *argv; |
37 | device = argv[optind]; | ||
38 | } else { | 32 | } else { |
39 | if (flags & OPT_SETCONS_RESET) | 33 | if (reset) |
40 | device = DEV_CONSOLE; | 34 | device = DEV_CONSOLE; |
41 | } | 35 | } |
42 | 36 | ||