Browse Source

Use getkey() and symbolic key names.

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
c5df1bc7df
1 changed files with 5 additions and 4 deletions
  1. 5
    4
      src/hci/readline.c

+ 5
- 4
src/hci/readline.c View File

@@ -19,6 +19,7 @@
19 19
 #include <string.h>
20 20
 #include <stdlib.h>
21 21
 #include <console.h>
22
+#include <gpxe/keys.h>
22 23
 #include <gpxe/editstring.h>
23 24
 #include <readline/readline.h>
24 25
 
@@ -92,17 +93,17 @@ char * readline ( const char *prompt ) {
92 93
 
93 94
 	buf[0] = '\0';
94 95
 	while ( 1 ) {
95
-		key = edit_string ( &string, getchar() );
96
+		key = edit_string ( &string, getkey() );
96 97
 		sync_console ( &string );
97 98
 		switch ( key ) {
98
-		case 0x0d: /* Carriage return */
99
-		case 0x0a: /* Line feed */
99
+		case CR:
100
+		case LF:
100 101
 			putchar ( '\n' );
101 102
 			line = strdup ( buf );
102 103
 			if ( ! line )
103 104
 				printf ( "Out of memory\n" );
104 105
 			return line;
105
-		case 0x03: /* Ctrl-C */
106
+		case CTRL_C:
106 107
 			putchar ( '\n' );
107 108
 			return NULL;
108 109
 		default:

Loading…
Cancel
Save