2006-12-20 05:37:33 +00:00
|
|
|
#include <string.h>
|
2007-01-19 01:13:12 +00:00
|
|
|
#include <stdio.h>
|
2006-12-20 05:37:33 +00:00
|
|
|
#include <gpxe/command.h>
|
|
|
|
|
#include <gpxe/settings.h>
|
|
|
|
|
#include <gpxe/settings_ui.h>
|
|
|
|
|
|
|
|
|
|
static int config_exec ( int argc, char **argv ) {
|
2008-03-20 21:01:32 +00:00
|
|
|
struct settings *settings = NULL;
|
2006-12-20 11:42:48 +00:00
|
|
|
int rc;
|
2006-12-20 05:37:33 +00:00
|
|
|
|
2008-03-20 04:06:07 +00:00
|
|
|
if ( argc > 2 ) {
|
|
|
|
|
printf ( "Usage: %s [scope]\n"
|
2006-12-20 05:37:33 +00:00
|
|
|
"Opens the option configuration console\n", argv[0] );
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2008-03-20 04:06:07 +00:00
|
|
|
if ( argc == 2 ) {
|
|
|
|
|
settings = find_settings ( argv[1] );
|
|
|
|
|
if ( ! settings ) {
|
|
|
|
|
printf ( "No such scope \"%s\"\n", argv[1] );
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
2006-12-20 05:37:33 +00:00
|
|
|
}
|
|
|
|
|
|
2008-03-20 04:06:07 +00:00
|
|
|
if ( ( rc = settings_ui ( settings ) ) != 0 ) {
|
2006-12-20 11:42:48 +00:00
|
|
|
printf ( "Could not save settings: %s\n",
|
|
|
|
|
strerror ( rc ) );
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
2006-12-20 05:37:33 +00:00
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct command config_command __command = {
|
|
|
|
|
.name = "config",
|
|
|
|
|
.exec = config_exec,
|
|
|
|
|
};
|