diff options
author | Michael Brown | 2011-03-22 20:12:10 +0100 |
---|---|---|
committer | Michael Brown | 2011-03-22 21:13:50 +0100 |
commit | 5fbd0207b269ca555dd904e297128ae3e9c0e984 (patch) | |
tree | 5920f64050f37f3d7be226c279fbe02200779541 /src/hci/commands | |
parent | [settings] Provide fetch_setting_origin() (diff) | |
download | ipxe-5fbd0207b269ca555dd904e297128ae3e9c0e984.tar.gz ipxe-5fbd0207b269ca555dd904e297128ae3e9c0e984.tar.xz ipxe-5fbd0207b269ca555dd904e297128ae3e9c0e984.zip |
[settings] Display canonical setting name in output of "show" command
Enable the "show" command to display the full, canonicalised name of
the fetched setting. For example:
iPXE> show mac
net0/mac:hex = 52:54:00:12:34:56
iPXE> dhcp && show ip
DHCP (net0 52:54:00:12:34:56)... ok
net0.dhcp/ip:ipv4 = 10.0.0.168
iPXE> show net0/6
net0.dhcp/dns:ipv4 = 10.0.0.6
Inspired-by: Glenn Brown <glenn@myri.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/hci/commands')
-rw-r--r-- | src/hci/commands/nvo_cmd.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/hci/commands/nvo_cmd.c b/src/hci/commands/nvo_cmd.c index 35c9d473..88d41270 100644 --- a/src/hci/commands/nvo_cmd.c +++ b/src/hci/commands/nvo_cmd.c @@ -54,7 +54,8 @@ static struct command_descriptor show_cmd = static int show_exec ( int argc, char **argv ) { struct show_options opts; const char *name; - char buf[256]; + char name_buf[32]; + char value_buf[256]; int rc; /* Parse options */ @@ -65,15 +66,16 @@ static int show_exec ( int argc, char **argv ) { name = argv[optind]; /* Fetch setting */ - if ( ( rc = fetchf_named_setting ( name, buf, - sizeof ( buf ) ) ) < 0 ) { + if ( ( rc = fetchf_named_setting ( name, name_buf, sizeof ( name_buf ), + value_buf, + sizeof ( value_buf ) ) ) < 0 ) { printf ( "Could not find \"%s\": %s\n", name, strerror ( rc ) ); return rc; } /* Print setting value */ - printf ( "%s = %s\n", name, buf ); + printf ( "%s = %s\n", name_buf, value_buf ); return 0; } |