26RCSIDH(command_h,
"$Id: 3cdf8eb3ff240c43af3443982f1ad669233e2a1e $")
28#include <freeradius-devel/util/value.h>
34#define CMD_MAX_ARGV (32)
62#define CMD_TABLE_END { .help = NULL }
87#define FR_COMMAND_OPTION_NONE (0)
88#define FR_COMMAND_OPTION_LIST_CHILD (1 << 0)
89#define FR_COMMAND_OPTION_NAME (1 << 1)
90#define FR_COMMAND_OPTION_HELP (1 << 2)
96 int max_expansions,
char const **expansions);
int(* fr_cmd_walk_t)(void *ctx, fr_cmd_walk_info_t *)
int fr_command_clear(int new_argc, fr_cmd_info_t *info)
Clear out any value boxes etc.
void fr_command_list(FILE *fp, int max_depth, fr_cmd_t *head, int options)
int fr_command_walk(fr_cmd_t *head, void **walk_ctx, void *ctx, fr_cmd_walk_t callback)
Walk over a command hierarchy.
bool add_name
do we add a name here?
int fr_command_run(FILE *fp, FILE *fp_err, fr_cmd_info_t *info, bool read_only)
Run a particular command.
int fr_command_add_multi(TALLOC_CTX *talloc_ctx, fr_cmd_t **heap_p, char const *name, void *ctx, fr_cmd_table_t const *table)
Add multiple commands to the global command tree.
char const * help
help text
int argc
current argument count
void fr_command_info_init(TALLOC_CTX *ctx, fr_cmd_info_t *info)
Initialize an fr_cmd_info_t structure.
int(* fr_cmd_func_t)(FILE *fp, FILE *fp_err, void *ctx, fr_cmd_info_t const *info)
bool fr_command_strncmp(const char *text, const char *name)
fr_cmd_func_t func
function to process this command
char const * syntax
e.g. "STRING"
fr_value_box_t ** box
value_box version of commands.
char const * parent
e.g. "show module"
int fr_command_add(TALLOC_CTX *talloc_ctx, fr_cmd_t **head_p, char const *name, void *ctx, fr_cmd_table_t const *table)
Add one command to the global command tree.
int fr_command_print_help(FILE *fp, fr_cmd_t *head, char const *text)
Do readline-style help completions.
fr_command_register_hook_t fr_command_register_hook
void fr_command_debug(FILE *fp, fr_cmd_t *head)
char const * fr_command_help(fr_cmd_t *head, int argc, char *argv[])
Get help text for a particular command.
int fr_command_complete(fr_cmd_t *head, char const *text, int start, int max_expansions, char const **expansions)
Do readline-style command completions.
fr_cmd_tab_t tab_expand
tab expand things in the syntax string
bool runnable
is the command runnable?
int(* fr_command_register_hook_t)(TALLOC_CTX *talloc_ctx, char const *name, void *ctx, fr_cmd_table_t *table)
int max_argc
maximum number of arguments
char const * name
e.g. "stats"
char const ** argv
text version of commands
int(* fr_cmd_tab_t)(TALLOC_CTX *talloc_ctx, void *ctx, fr_cmd_info_t *info, int max_expansions, char const **expansions)
int fr_command_tab_expand(TALLOC_CTX *ctx, fr_cmd_t *head, fr_cmd_info_t *info, int max_expansions, char const **expansions)
Get the commands && help at a particular level.
int fr_command_str_to_argv(fr_cmd_t *head, fr_cmd_info_t *info, char const *str)
Split a string in-place, updating argv[].
fr_cmd_t ** cmd
cached commands at each offset