Added cmdl_show proof-of-concept
[people/xl0/gpxe.git] / src / core / settings.c
index e15fc29..a7a708a 100644 (file)
@@ -251,3 +251,36 @@ struct config_setting_type config_setting_type_ipv4 __config_setting_type = {
        .set = set_ipv4,
 };
 
+/** Some basic setting definitions */
+struct config_setting basic_config_settings[] __config_setting = {
+       {
+               .name = "hostname",
+               .tag = DHCP_HOST_NAME,
+               .type = &config_setting_type_string,
+       },
+       {
+               .name = "ip",
+               .tag = DHCP_EB_YIADDR,
+               .type = &config_setting_type_ipv4,
+       },
+};
+
+
+
+/* Quick and dirty proof of concept */
+int cmdl_show ( int argc, char **argv ) {
+       char buf[256];
+       struct config_context dummy_context = { NULL };
+       int rc;
+
+       if ( argc < 2 )
+               return -EINVAL;
+       
+       if ( ( rc = show_setting ( &dummy_context, argv[1],
+                                  buf, sizeof ( buf ) ) ) != 0 )
+               return rc;
+
+       printf ( "%s = %s\n", argv[1], buf );
+       return 0;
+}
+