3 # Patch managed by http://www.holgerschurig.de/patcher.html
7 +++ busybox-1.00/console-tools/getkey.c
9 +/* vi: set sw=4 ts=4: */
11 + * getkey.c - Michael 'Mickey' Lauer
15 + * A simple keygrapper. Displays a configurable message and waits a dedicated number
16 + * of seconds for a keypress. Sets the exit code accordingly (SUCCESS on keypress).
23 +#include <sys/types.h>
25 +#include <sys/ioctl.h>
29 +extern int getkey_main(int argc, char **argv)
31 + int status = EXIT_FAILURE;
39 + * If no terminal is attached it is quite useless
40 + * to treat it like one.
42 + if( !isatty(STDIN_FILENO) )
47 + //bb_printf( "DEBUG: time = '%s'\n", argv[1] );
48 + //bb_printf( "DEBUG: mesg = '%s'\n", argv[2] );
50 + struct termios orig;
51 + struct termios attr;
53 + if ( tcgetattr(STDIN_FILENO, &orig) == -1 )
59 + attr.c_cc[VMIN] = 0;
60 + attr.c_cc[VTIME] = 0;
61 + attr.c_iflag |= INLCR;
62 + attr.c_oflag |= OPOST|ONLCR;
63 + attr.c_cflag &= ~PARENB;
64 + attr.c_lflag &= ~(ICANON/*|ECHO*/);
65 + if ( tcsetattr(STDIN_FILENO,TCSANOW,&attr) == -1 )
77 + tv.tv_sec = atoi( argv[1] );
82 + bb_printf( argv[2], tv.tv_sec );
86 + retval = select(1, &rfds, NULL, NULL, &tv);
89 + status = EXIT_SUCCESS;
92 + if (tcsetattr(STDIN_FILENO,TCSANOW,&orig) == -1 )
100 + return EXIT_FAILURE;
103 --- busybox-1.00/console-tools/Makefile.in~add-getkey-applet.patch
104 +++ busybox-1.00/console-tools/Makefile.in
106 CONSOLETOOLS_DIR-$(CONFIG_CLEAR) += clear.o
107 CONSOLETOOLS_DIR-$(CONFIG_DEALLOCVT) += deallocvt.o
108 CONSOLETOOLS_DIR-$(CONFIG_DUMPKMAP) += dumpkmap.o
109 +CONSOLETOOLS_DIR-$(CONFIG_GETKEY) += getkey.o
110 CONSOLETOOLS_DIR-$(CONFIG_LOADFONT) += loadfont.o
111 CONSOLETOOLS_DIR-$(CONFIG_LOADKMAP) += loadkmap.o
112 CONSOLETOOLS_DIR-$(CONFIG_OPENVT) += openvt.o
113 --- busybox-1.00/console-tools/Config.in~add-getkey-applet.patch
114 +++ busybox-1.00/console-tools/Config.in
116 This program dumps the kernel's keyboard translation table to
117 stdout, in binary format. You can then use loadkmap to load it.
119 +config CONFIG_GETKEY
123 + This program displays a configurable message and waits
124 + a dedicated number of seconds for a keypress. It sets
125 + the exit code accordingly, i.e. SUCCESS if there was a keypress.
127 config CONFIG_LOADFONT
130 --- busybox-1.00/include/applets.h~add-getkey-applet.patch
131 +++ busybox-1.00/include/applets.h
134 APPLET(ftpput, ftpgetput_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
136 +#ifdef CONFIG_GETKEY
137 + APPLET(getkey, getkey_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
140 APPLET(getopt, getopt_main, _BB_DIR_BIN, _BB_SUID_NEVER)
142 --- busybox-1.00/include/usage.h~add-getkey-applet.patch
143 +++ busybox-1.00/include/usage.h
145 "\t-p, --password Password to be used\n" \
146 "\t-P, --port Port number to be used"
148 +#define getkey_trivial_usage \
150 +#define getkey_full_usage \
151 + "Display a message and wait for a keypress."
152 +#define getkey_example_usage \
153 + "$ getkey 5 'Press a key within %d seconds to interrupt autoboot.'"
155 #define getopt_trivial_usage \
157 #define getopt_full_usage \