Browse Source

Use getkey() and symbolic key names.

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

Loading…
Cancel
Save