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 struct option setconsole_long_options[] = {
15 { "reset", 0, NULL, 'r' },
20 #define OPT_SETCONS_RESET 1
22 int setconsole_main(int argc, char **argv);
23 int setconsole_main(int argc, char **argv)
26 const char *device = CURRENT_TTY;
28 #if ENABLE_FEATURE_SETCONSOLE_LONG_OPTIONS
29 applet_long_options = setconsole_long_options;
31 flags = getopt32(argc, argv, "r");
33 if (argc - optind > 1)
36 if (argc - optind == 1) {
37 if (flags & OPT_SETCONS_RESET)
39 device = argv[optind];
41 if (flags & OPT_SETCONS_RESET)
45 xioctl(xopen(device, O_RDONLY), TIOCCONS, NULL);