9 #include <gpxe/settings.h>
10 #include <gpxe/command.h>
12 extern struct nvo_block *ugly_nvo_hack;
14 static int show_exec ( int argc, char **argv ) {
15 struct config_context dummy_context;
19 if ( ! ugly_nvo_hack ) {
20 printf ( "No non-volatile option storage available\n" );
25 printf ( "Syntax: %s <identifier>\n", argv[0] );
29 dummy_context.options = ugly_nvo_hack->options;
30 if ( ( rc = show_named_setting ( &dummy_context, argv[1], buf,
31 sizeof ( buf ) ) ) != 0 ) {
32 printf ( "Could not find \"%s\": %s\n",
33 argv[1], strerror ( -rc ) );
37 printf ( "%s = %s\n", argv[1], buf );
41 struct command show_command __command = {
46 static int set_exec ( int argc, char **argv ) {
47 struct config_context dummy_context;
50 if ( ! ugly_nvo_hack ) {
51 printf ( "No non-volatile option storage available\n" );
56 printf ( "Syntax: %s <identifier> <value>\n",
61 dummy_context.options = ugly_nvo_hack->options;
62 if ( ( rc = set_named_setting ( &dummy_context, argv[1],
64 printf ( "Could not set \"%s\"=\"%s\": %s\n",
65 argv[1], argv[2], strerror ( -rc ) );
69 if ( nvo_save ( ugly_nvo_hack ) != 0 ) {
70 printf ( "Could not save options to non-volatile storage\n" );
77 struct command set_command __command = {
82 static int clear_exec ( int argc, char **argv ) {
83 struct config_context dummy_context;
86 if ( ! ugly_nvo_hack ) {
87 printf ( "No non-volatile option storage available\n" );
92 printf ( "Syntax: %s <identifier>\n",
97 dummy_context.options = ugly_nvo_hack->options;
98 if ( ( rc = clear_named_setting ( &dummy_context, argv[1] ) ) != 0 ) {
99 printf ( "Could not clear \"%s\": %s\n",
100 argv[1], strerror ( -rc ) );
107 struct command clear_command __command = {