BRL-CAD
Loading...
Searching...
No Matches
Sub-Command Processing

Routine(s) for processing subcommands. More...

Collaboration diagram for Sub-Command Processing:

Files

file  cmd.h
 

Data Structures

struct  bu_cmdtab
 

Macros

#define BU_CMD_NULL   (int (*)(void *, int, const char **))NULL
 

Functions

int bu_cmd (const struct bu_cmdtab *cmds, int argc, const char *argv[], int cmd_index, void *data, int *result)
 Routine(s) for processing subcommands.
 
int bu_cmd_valid (const struct bu_cmdtab *cmds, const char *cmdname)
 

Detailed Description

Routine(s) for processing subcommands.

Macro Definition Documentation

◆ BU_CMD_NULL

#define BU_CMD_NULL   (int (*)(void *, int, const char **))NULL

Definition at line 37 of file cmd.h.

Function Documentation

◆ bu_cmd()

int bu_cmd ( const struct bu_cmdtab cmds,
int  argc,
const char argv[],
int  cmd_index,
void data,
int *  result 
)
extern

Routine(s) for processing subcommands.

This function is intended to be used for parsing subcommands. If the command is found in the array of commands, the associated function is called. Otherwise, an error message is printed along with a list of available commands. This behavior can be suppressed by registering a bu_log() callback.

bu_log_add_hook(NULL, NULL); // disables logging
bu_cmd(...);
Definition dvec.h:74
int bu_cmd(const struct bu_cmdtab *cmds, int argc, const char *argv[], int cmd_index, void *data, int *result)
Routine(s) for processing subcommands.
void bu_log_hook_restore_all(struct bu_hook_list *restore_hlp)
void bu_log_hook_delete_all(void)
void bu_log_add_hook(bu_hook_t func, void *clientdata)
void bu_log_hook_save_all(struct bu_hook_list *save_hlp)
#define BU_HOOK_LIST_INIT_ZERO
Definition hook.h:61
Parameters
cmds- commands and related function pointers
argc- number of arguments in argv
argv- command to execute and its arguments
cmd_index- indicates which argv element holds the subcommand
data- data/state associated with the command
result- if non-NULL, return value from the command
Returns
BRLCAD_OK if command was found, otherwise, BRLCAD_ERROR.

◆ bu_cmd_valid()

int bu_cmd_valid ( const struct bu_cmdtab cmds,
const char cmdname 
)
extern

Returns BRLCAD_OK if cmdname defines a command in the cmds table, and BRLCAD_ERROR otherwise