1 #include <string.h> 2 #include <stdio.h> 3 #include <gpxe/command.h> 4 #include <gpxe/settings.h> 5 #include <gpxe/settings_ui.h> 6 7 FILE_LICENCE ( GPL2_OR_LATER ); 8 config_exec(int argc,char ** argv)9static int config_exec ( int argc, char **argv ) { 10 char *settings_name; 11 struct settings *settings; 12 int rc; 13 14 if ( argc > 2 ) { 15 printf ( "Usage: %s [scope]\n" 16 "Opens the option configuration console\n", argv[0] ); 17 return 1; 18 } 19 20 settings_name = ( ( argc == 2 ) ? argv[1] : "" ); 21 settings = find_settings ( settings_name ); 22 if ( ! settings ) { 23 printf ( "No such scope \"%s\"\n", settings_name ); 24 return 1; 25 } 26 27 if ( ( rc = settings_ui ( settings ) ) != 0 ) { 28 printf ( "Could not save settings: %s\n", 29 strerror ( rc ) ); 30 return 1; 31 } 32 33 return 0; 34 } 35 36 struct command config_command __command = { 37 .name = "config", 38 .exec = config_exec, 39 }; 40