--- AUTHORS.orig	2007-05-20 18:58:12.000000000 +0200
+++ AUTHORS	2007-07-29 03:49:46.000000000 +0200
@@ -27,7 +27,7 @@
     ftpput, ftpget
 
 Enrik Berkhan <Enrik.Berkhan@inka.de>
-    setconsole
+    setconsole, getcons
 
 Jim Bauer <jfbauer@nfr.com>
     modprobe shell dependency
--- console-tools/Config.in.orig	2007-05-20 18:55:25.000000000 +0200
+++ console-tools/Config.in	2007-07-29 03:49:46.000000000 +0200
@@ -31,6 +31,13 @@
 	  This program dumps the kernel's keyboard translation table to
 	  stdout, in binary format. You can then use loadkmap to load it.
 
+config GETCONS
+	bool "getcons"
+	default n
+	help
+	  This program redirects the system console to another device,
+	  like the current tty while logged in via telnet.
+
 config LOADFONT
 	bool "loadfont"
 	default n
--- console-tools/getcons.c.orig	1970-01-01 01:00:00.000000000 +0100
+++ console-tools/getcons.c	2007-07-29 03:49:46.000000000 +0200
@@ -0,0 +1,57 @@
+/* vi: set sw=4 ts=4: */
+/*
+ *  getcons.c - redirect system console output
+ *
+ *  Copyright (C) 2004,2005  Enrik Berkhan <Enrik.Berkhan@inka.de>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "libbb.h"
+#include <getopt.h>	/* for struct option */
+
+static const struct option getcons_long_options[] = {
+	{ "reset", 0, NULL, 'r' },
+	{ 0, 0, 0, 0 }
+};
+
+#define OPT_GETCONS_RESET 1
+
+int getcons_main(int argc, char **argv)
+{
+	int con;
+	unsigned long flags;
+	const char *device = "/dev/tty";
+
+	applet_long_options = getcons_long_options;
+	flags = getopt32(argc, argv, "r");
+
+	if (argc - optind > 1)
+        	bb_show_usage();
+
+	if (argc - optind == 1) {
+		if (flags & OPT_GETCONS_RESET)
+			bb_show_usage();
+		device = argv[optind];
+    } else {
+		if (flags & OPT_GETCONS_RESET)
+			device = DEV_CONSOLE;
+	}
+
+	if (-1 == ioctl(xopen(device, O_RDONLY), TIOCCONS)) {
+		bb_perror_msg_and_die("TIOCCONS");
+	}
+	return EXIT_SUCCESS;
+}
--- console-tools/Kbuild.orig	2007-05-20 18:55:25.000000000 +0200
+++ console-tools/Kbuild	2007-07-29 03:49:46.000000000 +0200
@@ -9,6 +9,7 @@
 lib-$(CONFIG_CLEAR)		+= clear.o
 lib-$(CONFIG_DEALLOCVT)		+= deallocvt.o
 lib-$(CONFIG_DUMPKMAP)		+= dumpkmap.o
+lib-$(CONFIG_GETCONS)	+= getcons.o
 lib-$(CONFIG_SETCONSOLE)	+= setconsole.o
 lib-$(CONFIG_LOADFONT)		+= loadfont.o
 lib-$(CONFIG_LOADKMAP)		+= loadkmap.o
--- include/applets.h.orig	2007-05-20 18:57:20.000000000 +0200
+++ include/applets.h	2007-07-29 03:49:46.000000000 +0200
@@ -135,6 +135,7 @@
 USE_FTPGET(APPLET_ODDNAME(ftpget, ftpgetput, _BB_DIR_USR_BIN, _BB_SUID_NEVER,ftpget))
 USE_FTPPUT(APPLET_ODDNAME(ftpput, ftpgetput, _BB_DIR_USR_BIN, _BB_SUID_NEVER,ftpput))
 USE_FUSER(APPLET(fuser, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
+USE_GETCONS(APPLET(getcons, _BB_DIR_BIN, _BB_SUID_NEVER))
 USE_GETENFORCE(APPLET(getenforce, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
 USE_GETOPT(APPLET(getopt, _BB_DIR_BIN, _BB_SUID_NEVER))
 USE_GETSEBOOL(APPLET(getsebool, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
--- include/usage.h.orig	2007-05-20 18:57:20.000000000 +0200
+++ include/usage.h	2007-07-29 03:49:46.000000000 +0200
@@ -3685,4 +3685,11 @@
        "	-r 169.254.x.x	Request this address first\n" \
        "	-v		Verbose"
 
+#define getcons_trivial_usage \
+       "[-r|--reset] [DEVICE]"
+#define getcons_full_usage \
+       "Redirects system console output to DEVICE (default: /dev/tty)" \
+       "\n\nOptions:\n" \
+       "	-r  reset output to /dev/console"
+
 #endif /* __BB_USAGE_H__ */
