#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <unistd.h>
#include <inttypes.h>
#include "cne_common.h"
Go to the source code of this file.
|
CNDP_API int | cli_scan_directory (struct cli_node *dir, cli_scan_t func, uint32_t flags, args_t *args) |
|
CNDP_API int | cli_find_node (const char *path, struct cli_node **ret) |
|
CNDP_API struct cli_node * | cli_find_cmd (const char *path) |
|
CNDP_API uint32_t | cli_dir_item_count (struct cli_node *node, uint32_t types) |
|
CNDP_API uint32_t | cli_path_cmd_count (void) |
|
CNDP_API uint32_t | cli_node_list_with_type (struct cli_node *node, uint32_t flags, void **ret) |
|
CNDP_API void | cli_node_list_free (void *node) |
|
CNDP_API uint32_t | cli_path_item_count (uint32_t types) |
|
CNDP_API struct cli_node * | cli_last_dir_in_path (const char *path) |
|
CNDP_API struct cli_node * | cli_search_dir (struct cli_node *dir, const char *name, uint32_t type) |
|
CNDP_API int | cli_scan_path (const char *path, cli_scan_t func, uint32_t flags, args_t *args) |
|
CNE Command line interface
Definition in file cli_search.h.
◆ cli_scan_directory()
CNDP_API int cli_scan_directory |
( |
struct cli_node * |
dir, |
|
|
cli_scan_t |
func, |
|
|
uint32_t |
flags, |
|
|
args_t * |
args |
|
) |
| |
typedef of function passed in cli_scan_directory() Scan a directory and call the func with the node found.
- Note
- Uses a thread variable called this_cli.
- Parameters
-
dir | Node pointer to directory to scan |
func | cli_scan_t function pointer |
flags | TODO |
args | void * used by the function being called. |
- Returns
- 0 on success or -1 on error
◆ cli_find_node()
CNDP_API int cli_find_node |
( |
const char * |
path, |
|
|
struct cli_node ** |
ret |
|
) |
| |
Find a node by path
- Note
- Uses a thread variable called this_cli.
- Parameters
-
path | Path to node |
ret | Pointer to pointer of a cli_node if found |
- Returns
- 1 if found else 0
◆ cli_find_cmd()
CNDP_API struct cli_node* cli_find_cmd |
( |
const char * |
path | ) |
|
Search the local and bin directories for a command
- Note
- Uses a thread variable called this_cli.
- Parameters
-
path | String for the command to use |
- Returns
- Pointer to the command node or NULL
◆ cli_dir_item_count()
CNDP_API uint32_t cli_dir_item_count |
( |
struct cli_node * |
node, |
|
|
uint32_t |
types |
|
) |
| |
Count the number of type(s) of nodes available in a given node
- Note
- Uses a thread variable called this_cli.
- Parameters
-
node | node or NULL for current working directory |
types | TODO |
- Returns
- Number of nodes found of this type in the directory
◆ cli_path_cmd_count()
CNDP_API uint32_t cli_path_cmd_count |
( |
void |
| ) |
|
Count the number of commands in the execute path
- Note
- Uses a thread variable called this_cli.
- Returns
- Number of nodes found of this type in the directory
◆ cli_node_list_with_type()
CNDP_API uint32_t cli_node_list_with_type |
( |
struct cli_node * |
node, |
|
|
uint32_t |
flags, |
|
|
void ** |
ret |
|
) |
| |
Return a list of nodes matching given information
- Note
- Uses a thread variable called this_cli.
- Parameters
-
node | Node to start search or use the path list. |
flags | Type of nodes to return |
ret | Pointer to an array of pointer for return value |
- Returns
- Number of nodes found of this type in the directory
◆ cli_node_list_free()
CNDP_API void cli_node_list_free |
( |
void * |
node | ) |
|
Free a node back to the free list
- Note
- Uses a thread variable called this_cli.
- Parameters
-
node | Pointer to the node to free |
- Returns
- N/A
◆ cli_path_item_count()
CNDP_API uint32_t cli_path_item_count |
( |
uint32_t |
types | ) |
|
Count the number of commands in the execute path
- Note
- Uses a thread variable called this_cli.
- Parameters
-
types | The number of nodes to count |
- Returns
- Number of nodes found of this type in the directory
◆ cli_last_dir_in_path()
CNDP_API struct cli_node* cli_last_dir_in_path |
( |
const char * |
path | ) |
|
Find and return the last node in a give path string
- Note
- Uses a thread variable called this_cli.
- Parameters
-
- Returns
- Pointer to last directory node in path
◆ cli_search_dir()
CNDP_API struct cli_node* cli_search_dir |
( |
struct cli_node * |
dir, |
|
|
const char * |
name, |
|
|
uint32_t |
type |
|
) |
| |
Scan a directory for a given string matching name
- Note
- Uses a thread variable called this_cli.
- Parameters
-
dir | Pointer to directory node to start with in scanning |
name | String to match the nodes with |
type | Type of nodes to include in scan. |
- Returns
- Number of nodes found of this type in the directory
◆ cli_scan_path()
CNDP_API int cli_scan_path |
( |
const char * |
path, |
|
|
cli_scan_t |
func, |
|
|
uint32_t |
flags, |
|
|
args_t * |
args |
|
) |
| |
Scan the directory given by the path
- Note
- Uses a thread variable called this_cli.
- Parameters
-
path | The path string to use |
func | The function to call when a match is found. |
flags | Type of files to include in match |
args | Arguments to include with function call. |
- Returns
- Number of nodes found of this type in the directory