73 goto err_parse_options;
77 goto err_parse_setting;
83 printf (
"Could not find \"%s\": %s\n",
151 char **args,
char **
value ) ) {
159 goto err_parse_options;
164 goto err_parse_setting;
178 printf (
"Could not store \"%s\": %s\n",
202 char **args,
char **
value ) {
301 "<setting> [<increment>]" );
313 unsigned int increment = 1;
319 goto err_parse_options;
323 goto err_parse_setting;
326 if ( ( (
optind + 1 ) < argc ) &&
328 goto err_parse_increment;
346 printf (
"Could not store \"%s\": %s\n",
int parse_integer(char *text, unsigned int *value)
Parse integer value.
struct option_descriptor read[1]
"set", "clear", and "read" options
struct arbelprm_rc_send_wqe rc
int printf(const char *fmt,...)
Write a formatted string to the console.
static struct command_descriptor set_cmd
"set" command descriptor
int optind
Current option index.
struct option_descriptor set[0]
static int inc_exec(int argc, char **argv)
"inc" command
int fetchf_setting_copy(struct settings *settings, const struct setting *setting, struct settings **origin, struct setting *fetched, char **value)
Fetch copy of formatted value of setting.
static int clear_exec(int argc, char **argv)
"clear" command
static int clear_value(struct named_setting *setting __unused, struct set_core_options *opts __unused, char **args __unused, char **value)
Get setting value for "clear" command.
static struct option_descriptor show_opts[]
"show" option list
int parse_timeout(char *text, unsigned long *value)
Parse timeout value (in ms)
int storen_setting(struct settings *settings, const struct setting *setting, unsigned long value)
Store numeric value of setting.
int parse_autovivified_setting(char *text, struct named_setting *setting)
Parse and autovivify setting name.
static int show_exec(int argc, char **argv)
"show" command
static int set_value(struct named_setting *setting __unused, struct set_core_options *opts __unused, char **args, char **value)
Get setting value for "set" command.
static struct command_descriptor clear_cmd
"clear" command descriptor
int parse_options(int argc, char **argv, struct command_descriptor *cmd, void *opts)
Parse command-line options.
static struct option_descriptor inc_opts[]
"inc" option list
static int set_exec(int argc, char **argv)
"set" command
#define ENOMEM
Not enough space.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
Parse command-line options.
pseudo_bit_t value[0x00020]
#define __unused
Declare a variable or data structure as unused.
#define MAX_ARGUMENTS
No maximum number of arguments.
static int set_core_exec(int argc, char **argv, struct command_descriptor *cmd, int(*get_value)(struct named_setting *setting, struct set_core_options *opts, char **args, char **value))
"set", "clear", and "read" command
char * concat_args(char **args)
Concatenate arguments.
const struct setting_type * type
Setting type.
int parse_existing_setting(char *text, struct named_setting *setting)
Parse existing setting name.
int fetchn_setting(struct settings *settings, const struct setting *setting, struct settings **origin, struct setting *fetched, unsigned long *value)
Fetch numeric value of setting.
int storef_setting(struct settings *settings, const struct setting *setting, const char *value)
Store formatted value of setting.
char * strerror(int errno)
Retrieve string representation of error number.
static void(* free)(struct refcnt *refcnt))
A readline history buffer.
static struct command_descriptor show_cmd
"show" command descriptor
Command line option parsing.
const char * name
Name of the command.
unsigned long timeout
Timeout.
struct option_descriptor clear[0]
static int read_value(struct named_setting *setting, struct set_core_options *opts, char **args __unused, char **value)
Get setting value for "read" command.
static int read_exec(int argc, char **argv)
"read" command
struct command nvo_commands [] __command
Non-volatile option commands.
#define OPTION_DESC(_longopt, _shortopt, _has_arg, _struct, _field, _parse)
Construct option descriptor.
Option requires an argument.
A command-line option descriptor.
#define COMMAND_DESC(_struct, _options, _min_args, _max_args, _usage)
Construct command descriptor.
static union @440 set_core_opts
"set", "clear", and "read" option list
static union @438 opts
"cert<xxx>" option list
static struct command_descriptor inc_cmd
"inc" command descriptor
static struct command_descriptor read_cmd
"read" command descriptor
int setting_name(struct settings *settings, const struct setting *setting, char *buf, size_t len)
Return full setting name.
#define NULL
NULL pointer (VOID *)