#include <errno.h>
#include <getopt.h>
#include <ipxe/netdevice.h>
-#include <ipxe/image.h>
#include <ipxe/parseopt.h>
/** @file
return 0;
}
+/**
+ * Parse key
+ *
+ * @v text Text
+ * @ret key Key
+ * @ret rc Return status code
+ */
+int parse_key ( const char *text, unsigned int *key ) {
+
+ /* Interpret single characters as being a literal key character */
+ if ( text[0] && ! text[1] ) {
+ *key = text[0];
+ return 0;
+ }
+
+ /* Otherwise, interpret as an integer */
+ return parse_integer ( text, key );
+}
+
/**
* Print command usage message
*
/** "prompt" option list */
static struct option_descriptor prompt_opts[] = {
OPTION_DESC ( "key", 'k', required_argument,
- struct prompt_options, key, parse_integer ),
+ struct prompt_options, key, parse_key ),
OPTION_DESC ( "timeout", 't', required_argument,
struct prompt_options, timeout, parse_integer ),
};
extern int parse_integer ( const char *text, unsigned int *value );
extern int parse_netdev ( const char *text, struct net_device **netdev );
extern int parse_flag ( const char *text __unused, int *flag );
+extern int parse_key ( const char *text, unsigned int *key );
extern void print_usage ( struct command_descriptor *cmd, char **argv );
extern int reparse_options ( int argc, char **argv,
struct command_descriptor *cmd, void *opts );