]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[parseopt] Move parse_settings() to parseopt.c
authorMichael Brown <mcb30@ipxe.org>
Thu, 18 Jul 2013 14:30:00 +0000 (15:30 +0100)
committerMichael Brown <mcb30@ipxe.org>
Mon, 22 Jul 2013 15:16:44 +0000 (16:16 +0100)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/core/parseopt.c
src/hci/commands/config_cmd.c
src/include/ipxe/parseopt.h

index 1ae5d9b20b818de60d9de65ec0866027be574fa1..15cca0859d3092af99b4e1c8173fbff4e9c563f3 100644 (file)
@@ -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
  *
index f1fb567c2b21e2d98084a6bd84d75cbc49558722..b81c866ff9faaac9201e62f36125290e94bf5b90 100644 (file)
@@ -44,28 +44,6 @@ static struct option_descriptor config_opts[] = {};
 static struct command_descriptor config_cmd =
        COMMAND_DESC ( struct config_options, config_opts, 0, 1, "[<scope>]" );
 
-/**
- * Parse settings scope name
- *
- * @v text             Text
- * @ret value          Integer value
- * @ret rc             Return status code
- */
-static int parse_settings ( const 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;
-}
-
 /**
  * "config" command
  *
index 1e1fe6b7935745e8e25cbcee23ab89acd4d34647..8aeed974bf865e95136ace226e5eb8b88aa54a62 100644 (file)
@@ -14,6 +14,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
 
 struct net_device;
 struct menu;
+struct settings;
 
 /** A command-line option descriptor */
 struct option_descriptor {
@@ -120,7 +121,7 @@ extern int parse_netdev ( char *text, struct net_device **netdev );
 extern int parse_menu ( char *text, struct menu **menu );
 extern int parse_flag ( char *text __unused, int *flag );
 extern int parse_key ( char *text, unsigned int *key );
-extern void print_usage ( struct command_descriptor *cmd, char **argv );
+extern int parse_settings ( char *text, struct settings **settings );
 extern int reparse_options ( int argc, char **argv,
                             struct command_descriptor *cmd, void *opts );
 extern int parse_options ( int argc, char **argv,