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 static int set_exec ( int argc, char **argv ) {
42 struct config_context dummy_context;
45 if ( ! ugly_nvo_hack ) {
46 printf ( "No non-volatile option storage available\n" );
51 printf ( "Syntax: %s <identifier> <value>\n",
56 dummy_context.options = ugly_nvo_hack->options;
57 if ( ( rc = set_named_setting ( &dummy_context, argv[1],
59 printf ( "Could not set \"%s\"=\"%s\": %s\n",
60 argv[1], argv[2], strerror ( -rc ) );
64 if ( nvo_save ( ugly_nvo_hack ) != 0 ) {
65 printf ( "Could not save options to non-volatile storage\n" );
72 static int clear_exec ( int argc, char **argv ) {
73 struct config_context dummy_context;
76 if ( ! ugly_nvo_hack ) {
77 printf ( "No non-volatile option storage available\n" );
82 printf ( "Syntax: %s <identifier>\n",
87 dummy_context.options = ugly_nvo_hack->options;
88 if ( ( rc = clear_named_setting ( &dummy_context, argv[1] ) ) != 0 ) {
89 printf ( "Could not clear \"%s\": %s\n",
90 argv[1], strerror ( -rc ) );
97 struct command nvo_commands[] __command = {