summaryrefslogtreecommitdiffstats
path: root/src/core/parseopt.c
diff options
context:
space:
mode:
authorMichael Brown2013-08-13 23:31:47 +0200
committerMichael Brown2013-08-19 18:22:52 +0200
commit564419c7e10e4ccec61b759b5d9ba7c59b8ff3b2 (patch)
tree7a8af052f7a9d0a8d5b134b3dfb0b23541e00d08 /src/core/parseopt.c
parent[settings] Expose memory map via settings mechanism (diff)
downloadipxe-564419c7e10e4ccec61b759b5d9ba7c59b8ff3b2.tar.gz
ipxe-564419c7e10e4ccec61b759b5d9ba7c59b8ff3b2.tar.xz
ipxe-564419c7e10e4ccec61b759b5d9ba7c59b8ff3b2.zip
[params] Add support for the general concept of a form parameter list
Signed-off-by: Michael Brown <mcb30@ipxe.org>
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 65ad4ec5..38b1f29f 100644
--- a/src/core/parseopt.c
+++ b/src/core/parseopt.c
@@ -29,6 +29,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/netdevice.h>
#include <ipxe/menu.h>
#include <ipxe/settings.h>
+#include <ipxe/params.h>
#include <ipxe/parseopt.h>
/** @file
@@ -251,6 +252,29 @@ int parse_autovivified_setting ( char *text, struct named_setting *setting ) {
}
/**
+ * Parse form parameter list name
+ *
+ * @v text Text
+ * @ret params Parameter list
+ * @ret rc Return status code
+ */
+int parse_parameters ( char *text, struct parameters **params ) {
+
+ /* Find parameter list */
+ *params = find_parameters ( text );
+ if ( ! *params ) {
+ if ( text ) {
+ printf ( "\"%s\": no such parameter list\n", text );
+ } else {
+ printf ( "No default parameter list\n" );
+ }
+ return -ENOENT;
+ }
+
+ return 0;
+}
+
+/**
* Print command usage message
*
* @v cmd Command descriptor