Changeset 2725 in MondoRescue for branches/2.2.9/mindi-busybox/console-tools/setconsole.c
- Timestamp:
- Feb 25, 2011, 9:26:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mindi-busybox/console-tools/setconsole.c
r1765 r2725 4 4 * 5 5 * Copyright (C) 2004,2005 Enrik Berkhan <Enrik.Berkhan@inka.de> 6 * Copyright (C) 2008 Bernhard Reutner-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 source tree. 8 9 */ 9 10 10 #include <getopt.h>11 11 #include "libbb.h" 12 12 13 #if ENABLE_FEATURE_SETCONSOLE_LONG_OPTIONS 14 static const char setconsole_longopts[] ALIGN1 = 15 "reset\0" No_argument "r" 16 ; 17 #endif 18 19 #define OPT_SETCONS_RESET 1 20 21 int setconsole_main(int argc, char **argv); 22 int setconsole_main(int argc, char **argv) 13 int setconsole_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 14 int setconsole_main(int argc UNUSED_PARAM, char **argv) 23 15 { 24 unsigned long flags;25 16 const char *device = CURRENT_TTY; 17 bool reset; 26 18 27 19 #if ENABLE_FEATURE_SETCONSOLE_LONG_OPTIONS 20 static const char setconsole_longopts[] ALIGN1 = 21 "reset\0" No_argument "r" 22 ; 28 23 applet_long_options = setconsole_longopts; 29 24 #endif 30 flags = getopt32(argv, "r"); 25 /* at most one non-option argument */ 26 opt_complementary = "?1"; 27 reset = getopt32(argv, "r"); 31 28 32 if (argc - optind > 1) 33 bb_show_usage(); 34 35 if (argc - optind == 1) { 36 if (flags & OPT_SETCONS_RESET) 37 bb_show_usage(); 38 device = argv[optind]; 29 argv += 1 + reset; 30 if (*argv) { 31 device = *argv; 39 32 } else { 40 if ( flags & OPT_SETCONS_RESET)33 if (reset) 41 34 device = DEV_CONSOLE; 42 35 }
Note:
See TracChangeset
for help on using the changeset viewer.