mirror of
https://github.com/ipxe/ipxe
synced 2025-12-22 04:50:25 +03:00
[parseopt] Move parse_settings() to parseopt.c
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user