summaryrefslogtreecommitdiffstats
path: root/src/core/parseopt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/parseopt.c')
-rw-r--r--src/core/parseopt.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/core/parseopt.c b/src/core/parseopt.c
index 57140690b..432e856d0 100644
--- a/src/core/parseopt.c
+++ b/src/core/parseopt.c
@@ -26,6 +26,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <errno.h>
#include <getopt.h>
#include <ipxe/netdevice.h>
+#include <ipxe/menu.h>
#include <ipxe/parseopt.h>
/** @file
@@ -114,6 +115,29 @@ int parse_netdev ( const char *text, struct net_device **netdev ) {
}
/**
+ * Parse menu name
+ *
+ * @v text Text
+ * @ret menu Menu
+ * @ret rc Return status code
+ */
+int parse_menu ( const char *text, struct menu **menu ) {
+
+ /* Find menu */
+ *menu = find_menu ( text );
+ if ( ! *menu ) {
+ if ( text ) {
+ printf ( "\"%s\": no such menu\n", text );
+ } else {
+ printf ( "No default menu\n" );
+ }
+ return -ENOENT;
+ }
+
+ return 0;
+}
+
+/**
* Parse flag
*
* @v text Text (ignored)