summaryrefslogtreecommitdiffstats
path: root/src/hci/commands/config_cmd.c
blob: 368a6ca4aee71dbdbe733cf9ef6790b7fa36c678 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <string.h>
#include <stdio.h>
#include <gpxe/command.h>
#include <gpxe/settings.h>
#include <gpxe/settings_ui.h>


#include <gpxe/nvo.h>
extern struct nvo_block *ugly_nvo_hack;


static int config_exec ( int argc, char **argv ) {
	struct config_context dummy_context;
	int rc;

	if ( argc != 1 ) {
		printf ( "Usage: %s\n"
			 "Opens the option configuration console\n", argv[0] );
		return 1;
	}

	if ( ! ugly_nvo_hack ) {
		printf ( "No non-volatile option storage available\n" );
		return 1;
	}

	dummy_context.options = ugly_nvo_hack->options;
	if ( ( rc = settings_ui ( &dummy_context ) ) != 0 ) {
		printf ( "Could not save settings: %s\n",
			 strerror ( rc ) );
		return 1;
	}

	return 0;
}

struct command config_command __command = {
	.name = "config",
	.exec = config_exec,
};