diff options
author | Michael Brown | 2006-12-20 05:20:13 +0100 |
---|---|---|
committer | Michael Brown | 2006-12-20 05:20:13 +0100 |
commit | 35edecac34e129ea075e00d021fc6e786fa20777 (patch) | |
tree | eec108ce34d9786c0cabf35f510d98ac7cb5f1dd /src/hci/tui | |
parent | Added messages for some of the most common errors (diff) | |
download | ipxe-35edecac34e129ea075e00d021fc6e786fa20777.tar.gz ipxe-35edecac34e129ea075e00d021fc6e786fa20777.tar.xz ipxe-35edecac34e129ea075e00d021fc6e786fa20777.zip |
Move {show,set,clear}_setting() to {show,set,clear}_named_setting().
Introduce new {show,set,clear}_setting() that take a struct setting *
rather than a const char *.
set_setting() handles calling clear_setting() when appropriate, so that
individual setting types don't have to check for empty strings.
Diffstat (limited to 'src/hci/tui')
-rw-r--r-- | src/hci/tui/settings_ui.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/hci/tui/settings_ui.c b/src/hci/tui/settings_ui.c index f04140a1..7da95910 100644 --- a/src/hci/tui/settings_ui.c +++ b/src/hci/tui/settings_ui.c @@ -91,9 +91,8 @@ static void load_setting ( struct setting_widget *widget ) { widget->editing = 0; /* Read current setting value */ - if ( widget->setting->type->show ( widget->context, widget->setting, - widget->value, - sizeof ( widget->value ) ) != 0 ) { + if ( show_setting ( widget->context, widget->setting, + widget->value, sizeof ( widget->value ) ) != 0 ) { widget->value[0] = '\0'; } @@ -110,8 +109,7 @@ static void load_setting ( struct setting_widget *widget ) { * @v widget Setting widget */ static int save_setting ( struct setting_widget *widget ) { - return widget->setting->type->set ( widget->context, widget->setting, - widget->value ); + return set_setting ( widget->context, widget->setting, widget->value ); } /** @@ -252,7 +250,7 @@ static void main_loop ( struct config_context *context ) { if ( ( rc = save_setting ( &widget ) ) != 0 ) { alert ( " Could not set %s: %s ", widget.setting->name, - strerror ( -rc ) ); + strerror ( rc ) ); } /* Fall through */ case 0x03: /* Ctrl-C */ |