summaryrefslogtreecommitdiffstats
path: root/src/core/parseopt.c
diff options
context:
space:
mode:
authorMichael Brown2013-07-18 16:30:00 +0200
committerMichael Brown2013-07-22 17:16:44 +0200
commit46433f9b5eb917e6ad90ffaa169febdfcf78270f (patch)
tree022ddd055a424770d7af538e5ea2b75241e07fe9 /src/core/parseopt.c
parent[parseopt] Allow parsed option to be modified (diff)
downloadipxe-46433f9b5eb917e6ad90ffaa169febdfcf78270f.tar.gz
ipxe-46433f9b5eb917e6ad90ffaa169febdfcf78270f.tar.xz
ipxe-46433f9b5eb917e6ad90ffaa169febdfcf78270f.zip
[parseopt] Move parse_settings() to parseopt.c
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core/parseopt.c')
-rw-r--r--src/core/parseopt.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/core/parseopt.c b/src/core/parseopt.c
index 1ae5d9b2..15cca085 100644
--- a/src/core/parseopt.c
+++ b/src/core/parseopt.c
@@ -28,6 +28,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <getopt.h>
#include <ipxe/netdevice.h>
#include <ipxe/menu.h>
+#include <ipxe/settings.h>
#include <ipxe/parseopt.h>
/** @file
@@ -173,6 +174,28 @@ int parse_key ( char *text, unsigned int *key ) {
}
/**
+ * Parse settings block name
+ *
+ * @v text Text
+ * @ret value Integer value
+ * @ret rc Return status code
+ */
+int parse_settings ( char *text, struct settings **value ) {
+
+ /* Sanity check */
+ assert ( text != NULL );
+
+ /* Parse scope name */
+ *value = find_settings ( text );
+ if ( ! *value ) {
+ printf ( "\"%s\": no such scope\n", text );
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+/**
* Print command usage message
*
* @v cmd Command descriptor