source: MondoRescue/branches/2.2.9/mindi-busybox/console-tools/setconsole.c@ 2725

Last change on this file since 2725 was 2725, checked in by Bruno Cornec, 13 years ago
  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
File size: 922 bytes
RevLine 
[821]1/* 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>
[2725]6 * Copyright (C) 2008 Bernhard Reutner-Fischer
[821]7 *
[2725]8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
[821]9 */
10
[1765]11#include "libbb.h"
[821]12
[2725]13int setconsole_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
14int setconsole_main(int argc UNUSED_PARAM, char **argv)
[821]15{
16 const char *device = CURRENT_TTY;
[2725]17 bool reset;
[821]18
19#if ENABLE_FEATURE_SETCONSOLE_LONG_OPTIONS
[2725]20 static const char setconsole_longopts[] ALIGN1 =
21 "reset\0" No_argument "r"
22 ;
[1765]23 applet_long_options = setconsole_longopts;
[821]24#endif
[2725]25 /* at most one non-option argument */
26 opt_complementary = "?1";
27 reset = getopt32(argv, "r");
[821]28
[2725]29 argv += 1 + reset;
30 if (*argv) {
31 device = *argv;
[821]32 } else {
[2725]33 if (reset)
[1765]34 device = DEV_CONSOLE;
[821]35 }
36
[1765]37 xioctl(xopen(device, O_RDONLY), TIOCCONS, NULL);
[821]38 return EXIT_SUCCESS;
39}
Note: See TracBrowser for help on using the repository browser.