9 #include <gpxe/settings.h>
10 #include <gpxe/command.h>
14 extern struct nvo_block *ugly_nvo_hack;
16 static int show_exec ( int argc, char **argv ) {
17 struct config_context dummy_context;
21 if ( ! ugly_nvo_hack ) {
22 printf ( "No non-volatile option storage available\n" );
27 printf ( "Syntax: %s <identifier>\n", argv[0] );
31 dummy_context.options = ugly_nvo_hack->options;
32 if ( ( rc = show_setting ( &dummy_context, argv[1], buf,
33 sizeof ( buf ) ) ) != 0 ) {
34 printf ( "Could not find \"%s\": %s\n",
35 argv[1], strerror ( -rc ) );
39 printf ( "%s = %s\n", argv[1], buf );
43 struct command show_command __command = {
48 static int set_exec ( int argc, char **argv ) {
49 struct config_context dummy_context;
52 if ( ! ugly_nvo_hack ) {
53 printf ( "No non-volatile option storage available\n" );
58 printf ( "Syntax: %s <identifier> <value>\n",
63 dummy_context.options = ugly_nvo_hack->options;
64 if ( ( rc = set_setting ( &dummy_context, argv[1], argv[2] ) ) != 0 ) {
65 printf ( "Could not set \"%s\"=\"%s\": %s\n",
66 argv[1], argv[2], strerror ( -rc ) );
70 if ( nvo_save ( ugly_nvo_hack ) != 0 ) {
71 printf ( "Could not save options to non-volatile storage\n" );
78 struct command set_command __command = {
83 static int clear_exec ( int argc, char **argv ) {
84 struct config_context dummy_context;
87 if ( ! ugly_nvo_hack ) {
88 printf ( "No non-volatile option storage available\n" );
93 printf ( "Syntax: %s <identifier>\n",
98 dummy_context.options = ugly_nvo_hack->options;
99 if ( ( rc = clear_setting ( &dummy_context, argv[1] ) ) != 0 ) {
100 printf ( "Could not clear \"%s\": %s\n",
101 argv[1], strerror ( -rc ) );
108 struct command clear_command __command = {