iPXE
Data Structures | Functions | Variables
config_cmd.c File Reference

Configuration UI commands. More...

#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <getopt.h>
#include <ipxe/command.h>
#include <ipxe/parseopt.h>
#include <ipxe/settings.h>
#include <ipxe/settings_ui.h>

Go to the source code of this file.

Data Structures

struct  config_options
 "config" options More...
 

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
static int config_exec (int argc, char **argv)
 "config" command More...
 

Variables

static struct option_descriptor config_opts [] = {}
 "config" option list More...
 
static struct command_descriptor config_cmd
 "config" command descriptor More...
 
struct command config_command __command
 Configuration UI commands. More...
 

Detailed Description

Configuration UI commands.

Definition in file config_cmd.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ config_exec()

static int config_exec ( int  argc,
char **  argv 
)
static

"config" command

Parameters
argcArgument count
argvArgument list
Return values
rcReturn status code

Definition at line 58 of file config_cmd.c.

58  {
59  struct config_options opts;
60  struct settings *settings;
61  int rc;
62 
63  /* Parse options */
64  if ( ( rc = parse_options ( argc, argv, &config_cmd, &opts ) ) != 0 )
65  return rc;
66 
67  /* Parse settings option, if present */
68  if ( ( rc = parse_settings ( ( ( optind < argc ) ? argv[optind] : "" ),
69  &settings ) ) != 0 )
70  return rc;
71 
72  /* Run settings UI */
73  if ( ( rc = settings_ui ( settings ) ) != 0 ) {
74  printf ( "Could not save settings: %s\n", strerror ( rc ) );
75  return rc;
76  }
77 
78  return 0;
79 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
int optind
Current option index.
Definition: getopt.c:51
static union @424 opts
"cert<xxx>" option list
A settings user interface.
Definition: settings_ui.c:100
int parse_options(int argc, char **argv, struct command_descriptor *cmd, void *opts)
Parse command-line options.
Definition: parseopt.c:447
static struct command_descriptor config_cmd
"config" command descriptor
Definition: config_cmd.c:48
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
A settings block.
Definition: settings.h:132
"config" options
Definition: config_cmd.c:42
int parse_settings(char *text, struct settings **value)
Parse settings block name.
Definition: parseopt.c:234

References config_cmd, optind, opts, parse_options(), parse_settings(), printf(), rc, and strerror().

Variable Documentation

◆ config_opts

struct option_descriptor config_opts[] = {}
static

"config" option list

Definition at line 45 of file config_cmd.c.

◆ config_cmd

struct command_descriptor config_cmd
static
Initial value:
=
COMMAND_DESC ( struct config_options, config_opts, 0, 1, "[<scope>]" )
static struct option_descriptor config_opts[]
"config" option list
Definition: config_cmd.c:45
"config" options
Definition: config_cmd.c:42
#define COMMAND_DESC(_struct, _options, _min_args, _max_args, _usage)
Construct command descriptor.
Definition: parseopt.h:107

"config" command descriptor

Definition at line 48 of file config_cmd.c.

Referenced by config_exec().

◆ __command

struct command config_command __command
Initial value:
= {
.name = "config",
.exec = config_exec,
}
static int config_exec(int argc, char **argv)
"config" command
Definition: config_cmd.c:58

Configuration UI commands.

Definition at line 82 of file config_cmd.c.