From 46433f9b5eb917e6ad90ffaa169febdfcf78270f Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Thu, 18 Jul 2013 15:30:00 +0100 Subject: [parseopt] Move parse_settings() to parseopt.c Signed-off-by: Michael Brown --- src/core/parseopt.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/core') diff --git a/src/core/parseopt.c b/src/core/parseopt.c index 1ae5d9b20..15cca0859 100644 --- a/src/core/parseopt.c +++ b/src/core/parseopt.c @@ -28,6 +28,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include #include #include +#include #include /** @file @@ -172,6 +173,28 @@ int parse_key ( char *text, unsigned int *key ) { return parse_integer ( text, 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 * -- cgit v1.2.3-55-g7522