Synopsis
typedef struct {
unsigned terminal_width;
unsigned terminal_height;
size_t cursor;
char *buf;
int history_cursor;
int (*process_key)(CTL_CLI_CONTEXT_t *, int);
void (*process_interrupt)(void);
CTL_CLI_COMMAND_FUNCTION_t (*find_command)(CTL_CLI_CONTEXT_t *, const char *);
unsigned char telnet_options[];
} CTL_CLI_CONTEXT_t;
Description
CTL_CLI_CONTEXT_t defines an instance of the command line interpreter.
Structure
-
terminal_width
- The width of the terminal, in columns. For telnet sessions,
where window size is negotiated, this is set by the negotiation.
-
terminal_height
- The height of the terminal, in rows. For telnet sessions,
where window size is negotiated, this is set by the negotiation.
-
cursor
- Private position of the cursor when editing a line.
-
buf
- Pointer to the string to use when reading lines from the user.
-
history_cursor
- The position within the command line history. This is maintained
outside of the CLI methods.
-
process_key
- Process a keyboard input.
-
process_interrupt
- Process an interrupt request from the user (hitting the interrupt
key, rather than a hardware interrupt request).
-
find_command
- Search for a command and return the processing function.
-
telnet_options
- Private data holding the telnet option state.