summaryrefslogtreecommitdiffstats
path: root/src/hci
diff options
context:
space:
mode:
authorMichael Brown2012-08-31 04:52:06 +0200
committerMichael Brown2012-09-10 15:25:04 +0200
commit25ec56e0ecaa516a790fc409798e031af4bba650 (patch)
tree5fa960eb24c1cced9d376b4d4139458db71580bc /src/hci
parent[sdi] Add support for SDI images (diff)
downloadipxe-25ec56e0ecaa516a790fc409798e031af4bba650.tar.gz
ipxe-25ec56e0ecaa516a790fc409798e031af4bba650.tar.xz
ipxe-25ec56e0ecaa516a790fc409798e031af4bba650.zip
[settings] Use a generic setting's own type as its default type
When fetching a named setting using a name that does not explicitly specify a type, default to using the type stored when the setting was created, rather than always defaulting to "string". This allows the behaviour of user-defined settings to match the behaviour of predefined settings (which have a sensible default type). For example: set server:ipv4 192.168.0.1 echo ${server} will now print "192.168.0.1", rather than trying to print out the raw IPv4 address bytes as a string. The downside of this change is that existing tricks for printing special characters within scripts may require (backwards-compatible) modification. For example, the "clear screen" sequence: set esc:hex 1b set cls ${esc}[2J echo ${cls} will now have to become set esc:hex 1b set cls ${esc:string}[2J # Must now explicitly specify ":string" echo ${cls} Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/hci')
-rw-r--r--src/hci/commands/menu_cmd.c3
-rw-r--r--src/hci/commands/nvo_cmd.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/hci/commands/menu_cmd.c b/src/hci/commands/menu_cmd.c
index c11baea7..10966db2 100644
--- a/src/hci/commands/menu_cmd.c
+++ b/src/hci/commands/menu_cmd.c
@@ -249,7 +249,8 @@ static int choose_exec ( int argc, char **argv ) {
goto err_show_menu;
/* Store setting */
- if ( ( rc = storef_named_setting ( setting, item->label ) ) != 0 ) {
+ if ( ( rc = storef_named_setting ( setting, &setting_type_string,
+ item->label ) ) != 0 ) {
printf ( "Could not store \"%s\": %s\n",
setting, strerror ( rc ) );
goto err_store;
diff --git a/src/hci/commands/nvo_cmd.c b/src/hci/commands/nvo_cmd.c
index 4bb7f457..fb8ec876 100644
--- a/src/hci/commands/nvo_cmd.c
+++ b/src/hci/commands/nvo_cmd.c
@@ -127,7 +127,8 @@ static int set_core_exec ( int argc, char **argv,
goto err_get_value;
/* Determine total length of command line */
- if ( ( rc = storef_named_setting ( name, value ) ) != 0 ) {
+ if ( ( rc = storef_named_setting ( name, &setting_type_string,
+ value ) ) != 0 ) {
printf ( "Could not %s \"%s\": %s\n",
argv[0], name, strerror ( rc ) );
goto err_store;