#include <sys/queue.h>
#include <cne_common.h>
Go to the source code of this file.
|
CNDP_API struct cli_env * | cli_env_create (void) |
|
CNDP_API void | cli_env_destroy (struct cli_env *env) |
|
CNDP_API int | cli_env_set (struct cli_env *env, const char *var, const char *val) |
|
CNDP_API int | cli_env_string (struct cli_env *env, const char *var, cli_sfunc_t sfunc, const char *val) |
|
CNDP_API const char * | cli_env_get (struct cli_env *env, const char *var) |
|
CNDP_API int | cli_env_del (struct cli_env *env, const char *var) |
|
CNDP_API void | cli_env_substitution (struct cli_env *env, char *line, int sz) |
|
static int | cli_env_count (struct cli_env *env) |
|
CNDP_API int | cli_env_get_all (struct cli_env *env, struct env_node **list, int max_size) |
|
CNDP_API void | cli_env_show (struct cli_env *env) |
|
CNE Command line interface
Definition in file cli_env.h.
◆ cli_sfunc_t
typedef char*(* cli_sfunc_t) (const char *str) |
CLI function pointer type for a Environment node
Definition at line 22 of file cli_env.h.
◆ cli_env_create()
CNDP_API struct cli_env* cli_env_create |
( |
void |
| ) |
|
Create a environment for the cli
- Returns
- NULL on error or cli_env pointer
◆ cli_env_destroy()
CNDP_API void cli_env_destroy |
( |
struct cli_env * |
env | ) |
|
Delete the environment for the CLI
- Parameters
-
env | The pointer to the environment structure |
◆ cli_env_set()
CNDP_API int cli_env_set |
( |
struct cli_env * |
env, |
|
|
const char * |
var, |
|
|
const char * |
val |
|
) |
| |
Set a environment variable for the CLI
- Parameters
-
env | The cli_env pointer |
var | Pointer to the variable name const string |
val | Pointer to the string assigned to the variable |
- Returns
- 0 is OK was added or replaced or -1 if not valid
◆ cli_env_string()
CNDP_API int cli_env_string |
( |
struct cli_env * |
env, |
|
|
const char * |
var, |
|
|
cli_sfunc_t |
sfunc, |
|
|
const char * |
val |
|
) |
| |
Set a environment variable for the CLI with a function pointer
- Parameters
-
env | The cli_env pointer |
var | Pointer to the variable name const string. |
sfunc | Pointer to function (optional) |
val | Pointer to the string assigned to the variable |
- Returns
- 0 is OK was added or replaced or -1 if not valid
◆ cli_env_get()
CNDP_API const char* cli_env_get |
( |
struct cli_env * |
env, |
|
|
const char * |
var |
|
) |
| |
Get the environment variable from the cli
- Parameters
-
env | The cli_env pointer |
var | The const string variable name |
- Returns
- NULL if not found or the const string
◆ cli_env_del()
CNDP_API int cli_env_del |
( |
struct cli_env * |
env, |
|
|
const char * |
var |
|
) |
| |
Remove the environment variable from the cli
- Parameters
-
env | The cli_env pointer |
var | The const string variable name |
- Returns
- 0 is OK or -1 if not found.
◆ cli_env_substitution()
CNDP_API void cli_env_substitution |
( |
struct cli_env * |
env, |
|
|
char * |
line, |
|
|
int |
sz |
|
) |
| |
Do environment variable substitution on the line.
- Parameters
-
env | Pointer to the environment structure |
line | Pointer to the line to parse |
sz | Number of total characters the line can hold. |
- Returns
- N/A
◆ cli_env_count()
static int cli_env_count |
( |
struct cli_env * |
env | ) |
|
|
inlinestatic |
Get the number of variables in the environment
- Parameters
-
env | Pointer to environment structure |
- Returns
- Number of environment variables
Definition at line 131 of file cli_env.h.
◆ cli_env_get_all()
CNDP_API int cli_env_get_all |
( |
struct cli_env * |
env, |
|
|
struct env_node ** |
list, |
|
|
int |
max_size |
|
) |
| |
Get all of the environment variables
- Parameters
-
env | Pointer to environment list |
list | Array of env_node pointers to be returned |
max_size | Max size of the list array |
◆ cli_env_show()
CNDP_API void cli_env_show |
( |
struct cli_env * |
env | ) |
|
Show all environment variable
- Parameters
-
env | Pointer to the cli_env structure. |