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)
 
 FILE_SECBOOT (PERMITTED)
 
static int config_exec (int argc, char **argv)
 "config" command More...
 
 COMMAND (config, config_exec)
 Configuration UI commands. More...
 

Variables

static struct option_descriptor config_opts [] = {}
 "config" option list More...
 
static struct command_descriptor config_cmd
 "config" command descriptor More...
 

Detailed Description

Configuration UI commands.

Definition in file config_cmd.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED  )

◆ 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 59 of file config_cmd.c.

59  {
60  struct config_options opts;
61  struct settings *settings;
62  int rc;
63 
64  /* Parse options */
65  if ( ( rc = parse_options ( argc, argv, &config_cmd, &opts ) ) != 0 )
66  return rc;
67 
68  /* Parse settings option, if present */
69  if ( ( rc = parse_settings ( ( ( optind < argc ) ? argv[optind] : "" ),
70  &settings ) ) != 0 )
71  return rc;
72 
73  /* Run settings UI */
74  if ( ( rc = settings_ui ( settings ) ) != 0 ) {
75  printf ( "Could not save settings: %s\n", strerror ( rc ) );
76  return rc;
77  }
78 
79  return 0;
80 }
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:465
int optind
Current option index.
Definition: getopt.c:52
A settings user interface.
Definition: settings_ui.c:106
int parse_options(int argc, char **argv, struct command_descriptor *cmd, void *opts)
Parse command-line options.
Definition: parseopt.c:485
static struct command_descriptor config_cmd
"config" command descriptor
Definition: config_cmd.c:49
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:79
A settings block.
Definition: settings.h:133
"config" options
Definition: config_cmd.c:43
static union @447 opts
"cert<xxx>" option list
int parse_settings(char *text, struct settings **value)
Parse settings block name.
Definition: parseopt.c:272

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

◆ COMMAND()

COMMAND ( config  ,
config_exec   
)

Configuration UI commands.

Variable Documentation

◆ config_opts

struct option_descriptor config_opts[] = {}
static

"config" option list

Definition at line 46 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:46
"config" options
Definition: config_cmd.c:43
#define COMMAND_DESC(_struct, _options, _min_args, _max_args, _usage)
Construct command descriptor.
Definition: parseopt.h:109

"config" command descriptor

Definition at line 49 of file config_cmd.c.

Referenced by config_exec().