RPV Event driven kernel
Loading...
Searching...
No Matches
command_s Struct Reference

Command descriptor structure. More...

#include <command.h>

Data Fields

const char * text
 Null-terminated command name string.
 
int(*const handler )(const int argc, const char **argv)
 Command handler function pointer.
 

Detailed Description

Command descriptor structure.

Represents a shell command entry stored in the command table. Instances of this structure are typically placed in a dedicated linker section and discovered at runtime by the shell subsystem.

The structure binds a command name to its handler function.

Note
Objects of this type are expected to be constant and located in read-only memory.

Field Documentation

◆ handler

int(*const handler) (const int argc, const char **argv)

Command handler function pointer.

Function invoked when the command is executed.

Parameters
[in]argcNumber of arguments in argv.
[in]argvArray of argument strings.
Returns
Status code returned by the command handler.
Return values
0Command executed successfully.
<0Command failed (implementation-defined).
Precondition
  • argv always not NULL.
  • argc >= 1. When 1 argv just contains an exact typed command name
  • Handler must be reentrant if used in concurrent context.

◆ text

const char* text

Null-terminated command name string.

Must point to a valid constant string. The string must remain valid for the lifetime of the program.


The documentation for this struct was generated from the following file: