nvramcui: Trim values when setting.

Values get space-padded by curses and then enum search fails to match them.
Rtrim to compensate for curses.

Change-Id: Iecf095f21cfade9425eaa039b67625615eb80481
Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
Reviewed-on: http://review.coreboot.org/4692
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins)
This commit is contained in:
Vladimir Serbinenko 2014-01-15 22:07:52 +01:00 committed by Nico Huber
parent 571bec726c
commit c9babb278f
1 changed files with 4 additions and 0 deletions

View File

@ -232,6 +232,10 @@ int main()
for (i = 0; i < numopts; i++) { for (i = 0; i < numopts; i++) {
char *name = field_buffer(fields[2*i], 0); char *name = field_buffer(fields[2*i], 0);
char *value = field_buffer(fields[2*i+1], 0); char *value = field_buffer(fields[2*i+1], 0);
char *ptr;
for (ptr = value + strlen (value) - 1;
ptr >= value && *ptr == ' '; ptr--);
ptr[1] = '\0';
set_option_from_string(use_nvram, opttbl, value, name); set_option_from_string(use_nvram, opttbl, value, name);
} }