1 /* vi: set sw=4 ts=4: */
3 * setconsole.c - redirect system console output
5 * Copyright (C) 2004,2005 Enrik Berkhan <Enrik.Berkhan@inka.de>
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
12 #if ENABLE_FEATURE_SETCONSOLE_LONG_OPTIONS
13 static const char setconsole_longopts[] ALIGN1 =
14 "reset\0" No_argument "r"
18 #define OPT_SETCONS_RESET 1
20 int setconsole_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
21 int setconsole_main(int argc, char **argv)
24 const char *device = CURRENT_TTY;
26 #if ENABLE_FEATURE_SETCONSOLE_LONG_OPTIONS
27 applet_long_options = setconsole_longopts;
29 flags = getopt32(argv, "r");
31 if (argc - optind > 1)
34 if (argc - optind == 1) {
35 if (flags & OPT_SETCONS_RESET)
37 device = argv[optind];
39 if (flags & OPT_SETCONS_RESET)
43 xioctl(xopen(device, O_RDONLY), TIOCCONS, NULL);