summaryrefslogtreecommitdiffstats
path: root/recipes/busybox/busybox-1.3.1/add-getkey-applet.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/busybox/busybox-1.3.1/add-getkey-applet.patch')
-rw-r--r--recipes/busybox/busybox-1.3.1/add-getkey-applet.patch167
1 files changed, 167 insertions, 0 deletions
diff --git a/recipes/busybox/busybox-1.3.1/add-getkey-applet.patch b/recipes/busybox/busybox-1.3.1/add-getkey-applet.patch
new file mode 100644
index 0000000000..a75cf823c7
--- /dev/null
+++ b/recipes/busybox/busybox-1.3.1/add-getkey-applet.patch
@@ -0,0 +1,167 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+Index: busybox-1.1.0/console-tools/getkey.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ busybox-1.1.0/console-tools/getkey.c 2006-03-14 17:17:28.000000000 +0100
+@@ -0,0 +1,94 @@
++/* vi: set sw=4 ts=4: */
++/*
++ * getkey.c - Michael 'Mickey' Lauer
++ *
++ * Version 0.1
++ *
++ * A simple keygrapper. Displays a configurable message and waits a dedicated number
++ * of seconds for a keypress. Sets the exit code accordingly (SUCCESS on keypress).
++ */
++#include <stdio.h>
++#include <fcntl.h>
++#include <memory.h>
++#include <stdlib.h>
++#include <unistd.h>
++#include <sys/types.h>
++#include <errno.h>
++#include <sys/ioctl.h>
++#include <sys/kd.h>
++#include "busybox.h"
++
++extern int getkey_main(int argc, char **argv)
++{
++ int status = EXIT_FAILURE;
++
++ if ( argc < 2 )
++ {
++ bb_show_usage();
++ }
++
++ /*
++ * If no terminal is attached it is quite useless
++ * to treat it like one.
++ */
++ if( !isatty(STDIN_FILENO) )
++ {
++ goto error_hard;
++ }
++
++ //bb_printf( "DEBUG: time = '%s'\n", argv[1] );
++ //bb_printf( "DEBUG: mesg = '%s'\n", argv[2] );
++
++ struct termios orig;
++ struct termios attr;
++
++ if ( tcgetattr(STDIN_FILENO, &orig) == -1 )
++ {
++ goto error_hard;
++ }
++
++ attr = orig;
++ attr.c_cc[VMIN] = 0;
++ attr.c_cc[VTIME] = 0;
++ attr.c_iflag |= INLCR;
++ attr.c_oflag |= OPOST|ONLCR;
++ attr.c_cflag &= ~PARENB;
++ attr.c_lflag &= ~(ICANON/*|ECHO*/);
++ if ( tcsetattr(STDIN_FILENO,TCSANOW,&attr) == -1 )
++ {
++ goto error_hard;
++ }
++
++ fd_set rfds;
++ struct timeval tv;
++ int retval;
++
++ FD_ZERO(&rfds);
++ FD_SET(0, &rfds);
++
++ tv.tv_sec = atoi( argv[1] );
++ tv.tv_usec = 0;
++
++ if ( argc == 3 )
++ {
++ bb_printf( argv[2], tv.tv_sec );
++ bb_printf( "\n" );
++ fflush(stdout);
++ }
++ retval = select(1, &rfds, NULL, NULL, &tv);
++ if (retval > 0)
++ {
++ status = EXIT_SUCCESS;
++ }
++
++ if (tcsetattr(STDIN_FILENO,TCSANOW,&orig) == -1 )
++ {
++ goto error_hard;
++ }
++
++ return status;
++
++error_hard :
++ return EXIT_FAILURE;
++};
++
+Index: busybox-1.1.0/console-tools/Makefile.in
+===================================================================
+--- busybox-1.1.0.orig/console-tools/Makefile.in 2006-01-11 06:43:57.000000000 +0100
++++ busybox-1.1.0/console-tools/Makefile.in 2006-03-14 17:18:18.000000000 +0100
+@@ -21,6 +21,7 @@
+ CONSOLETOOLS_DIR-$(CONFIG_OPENVT) += openvt.o
+ CONSOLETOOLS_DIR-$(CONFIG_RESET) += reset.o
+ CONSOLETOOLS_DIR-$(CONFIG_SETKEYCODES) += setkeycodes.o
++CONSOLETOOLS_DIR-$(CONFIG_GETKEY) += getkey.o
+
+ libraries-y+=$(CONSOLETOOLS_DIR)$(CONSOLETOOLS_AR)
+
+Index: busybox-1.1.0/console-tools/Config.in
+===================================================================
+--- busybox-1.1.0.orig/console-tools/Config.in 2006-01-11 06:43:57.000000000 +0100
++++ busybox-1.1.0/console-tools/Config.in 2006-03-14 17:17:28.000000000 +0100
+@@ -31,6 +31,14 @@
+ This program dumps the kernel's keyboard translation table to
+ stdout, in binary format. You can then use loadkmap to load it.
+
++config CONFIG_GETKEY
++ bool "getkey"
++ default n
++ help
++ This program displays a configurable message and waits
++ a dedicated number of seconds for a keypress. It sets
++ the exit code accordingly, i.e. SUCCESS if there was a keypress.
++
+ config CONFIG_LOADFONT
+ bool "loadfont"
+ default n
+Index: busybox-1.1.0/include/applets.h
+===================================================================
+--- busybox-1.1.0.orig/include/applets.h 2006-01-11 06:44:14.000000000 +0100
++++ busybox-1.1.0/include/applets.h 2006-03-14 17:17:28.000000000 +0100
+@@ -261,6 +261,9 @@
+ #ifdef CONFIG_FUSER
+ APPLET(fuser, fuser_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
+ #endif
++#ifdef CONFIG_GETKEY
++ APPLET(getkey, getkey_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
++#endif
+ #ifdef CONFIG_GETOPT
+ APPLET(getopt, getopt_main, _BB_DIR_BIN, _BB_SUID_NEVER)
+ #endif
+Index: busybox-1.1.0/include/usage.h
+===================================================================
+--- busybox-1.1.0.orig/include/usage.h 2006-01-11 06:44:14.000000000 +0100
++++ busybox-1.1.0/include/usage.h 2006-03-14 17:19:11.000000000 +0100
+@@ -841,6 +841,13 @@
+ "\t-p, --password Password to be used\n" \
+ "\t-P, --port Port number to be used"
+
++#define getkey_trivial_usage \
++ "time [message]"
++#define getkey_full_usage \
++ "Display a message and wait for a keypress."
++#define getkey_example_usage \
++ "$ getkey 5 'Press a key within %d seconds to interrupt autoboot.'"
++
+ #define fuser_trivial_usage \
+ "[options] file OR port/proto"
+ #define fuser_full_usage \