summaryrefslogtreecommitdiffstats
path: root/src/hci/commands/config_cmd.c
blob: 5a34cea2798b2aa6b8288f9ea39b1dd4bf19eeee (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
#include <string.h>
#include <stdio.h>
#include <gpxe/command.h>
#include <gpxe/settings.h>
#include <gpxe/settings_ui.h>

static int config_exec ( int argc, char **argv ) {
	struct settings *settings = NULL;
	int rc;

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

	if ( argc == 2 ) {
		settings = find_settings ( argv[1] );
		if ( ! settings ) {
			printf ( "No such scope \"%s\"\n", argv[1] );
			return 1;
		}
	}

	if ( ( rc = settings_ui ( settings ) ) != 0 ) {
		printf ( "Could not save settings: %s\n",
			 strerror ( rc ) );
		return 1;
	}

	return 0;
}

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