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.
13 #if ENABLE_FEATURE_SETCONSOLE_LONG_OPTIONS
14 static const char setconsole_longopts[] ALIGN1 =
15 "reset\0" No_argument "r"
19 #define OPT_SETCONS_RESET 1
21 int setconsole_main(int argc, char **argv);
22 int setconsole_main(int argc, char **argv)
25 const char *device = CURRENT_TTY;
27 #if ENABLE_FEATURE_SETCONSOLE_LONG_OPTIONS
28 applet_long_options = setconsole_longopts;
30 flags = getopt32(argv, "r");
32 if (argc - optind > 1)
35 if (argc - optind == 1) {
36 if (flags & OPT_SETCONS_RESET)
38 device = argv[optind];
40 if (flags & OPT_SETCONS_RESET)
44 xioctl(xopen(device, O_RDONLY), TIOCCONS, NULL);