summaryrefslogtreecommitdiffstats
path: root/src/core/getkey.c
diff options
context:
space:
mode:
authorMichael Brown2009-01-25 22:10:48 +0100
committerMichael Brown2009-01-25 22:10:48 +0100
commitce9690ca39207262d5d5540f23b3fc4788005ccc (patch)
treec5591577af0f9f4adaf1e178f38da46f5ea1a82e /src/core/getkey.c
parent[dhcp] Clarify language surrounding ProxyDHCP (diff)
downloadipxe-ce9690ca39207262d5d5540f23b3fc4788005ccc.tar.gz
ipxe-ce9690ca39207262d5d5540f23b3fc4788005ccc.tar.xz
ipxe-ce9690ca39207262d5d5540f23b3fc4788005ccc.zip
[console] Allow KEY_xxx constants to cover F8 function key
F8 is represented by the ANSI escape sequence "^[[19~", which is not representable as a KEY_xxx constant using the current encoding scheme. Adapt the encoding scheme to allow F8 to be represented, since PXE requires that we may need to prompt the user to press F8.
Diffstat (limited to 'src/core/getkey.c')
-rw-r--r--src/core/getkey.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/core/getkey.c b/src/core/getkey.c
index 1551cf37..787c9027 100644
--- a/src/core/getkey.c
+++ b/src/core/getkey.c
@@ -16,6 +16,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <ctype.h>
#include <console.h>
#include <gpxe/process.h>
#include <gpxe/keys.h>
@@ -59,21 +60,22 @@ static int getchar_timeout ( unsigned long timeout ) {
*/
int getkey ( void ) {
int character;
- int key;
+ unsigned int n = 0;
character = getchar();
if ( character != ESC )
return character;
- key = 0;
while ( ( character = getchar_timeout ( GETKEY_TIMEOUT ) ) >= 0 ) {
if ( character == '[' )
continue;
- if ( ! key )
- key = KEY_ANSI ( character );
+ if ( isdigit ( character ) ) {
+ n = ( ( n * 10 ) + ( character - '0' ) );
+ continue;
+ }
if ( character >= 0x40 )
- break;
+ return KEY_ANSI ( n, character );
}
- return ( key ? key : ESC );
+ return ESC;
}