#include <strings.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cli.h"
#include "cli_common.h"
#include "cli_gapbuf.h"
#include "cne_log.h"
#include "cne_common.h"
#include "cne_stdio.h"
#include "cne_tty.h"
#include "vt100_out.h"
Go to the source code of this file.
CNE Command line input interface
Definition in file cli_input.h.
◆ cli_poll()
CNDP_API int cli_poll |
( |
char * |
c | ) |
|
Poll for a input character
- Parameters
-
c | Pointer to character address. |
- Returns
- return non-zero if character was read.
◆ cli_cursor_left()
static void cli_cursor_left |
( |
void |
| ) |
|
|
inlinestatic |
Move the vt100 cursor to the left one character
- Note
- Uses thread variable this_cli.
- Returns
- N/A
Definition at line 89 of file cli_input.h.
◆ cli_cursor_right()
static void cli_cursor_right |
( |
void |
| ) |
|
|
inlinestatic |
Move the vt100 cursor to the right one character
- Note
- Uses thread variable this_cli.
- Returns
- N/A
Definition at line 103 of file cli_input.h.
◆ cli_save_cursor()
static void cli_save_cursor |
( |
void |
| ) |
|
|
inlinestatic |
Save the vt100 cursor location
- Note
- Uses thread variable this_cli.
- Returns
- N/A
Definition at line 117 of file cli_input.h.
◆ cli_restore_cursor()
static void cli_restore_cursor |
( |
void |
| ) |
|
|
inlinestatic |
Restore the cursor to the saved location on the console
- Note
- Uses thread variable this_cli.
- Returns
- N/A
Definition at line 131 of file cli_input.h.
◆ cli_display_left()
static void cli_display_left |
( |
void |
| ) |
|
|
inlinestatic |
Print out the left side of the input in the Gap Buffer.
- Note
- Uses thread variable this_cli.
- Returns
- N/A
Definition at line 145 of file cli_input.h.
◆ cli_display_right()
static void cli_display_right |
( |
void |
| ) |
|
|
inlinestatic |
Print out the right side of the input in the Gap Buffer.
- Note
- Uses thread variable this_cli.
- Returns
- N/A
Definition at line 160 of file cli_input.h.
◆ cli_clear_screen()
static void cli_clear_screen |
( |
void |
| ) |
|
|
inlinestatic |
Clear the console screen
- Note
- Uses thread variable this_cli.
- Returns
- N/A
Definition at line 175 of file cli_input.h.
◆ cli_clear_to_eol()
static void cli_clear_to_eol |
( |
void |
| ) |
|
|
inlinestatic |
clear from cursor to end of line
- Note
- Uses thread variable this_cli.
- Returns
- N/A
Definition at line 189 of file cli_input.h.
◆ cli_clear_line()
static void cli_clear_line |
( |
int |
lineno | ) |
|
|
inlinestatic |
Clear the current line or the line given
- Note
- Uses thread variable this_cli.
- Parameters
-
lineno | if lineno is -1 then clear the current line else the lineno given. |
- Returns
- N/A
Definition at line 205 of file cli_input.h.
◆ cli_move_cursor_up()
static void cli_move_cursor_up |
( |
int |
lineno | ) |
|
|
inlinestatic |
Move the cursor up by the number of lines given
- Note
- Uses thread variable this_cli.
- Parameters
-
lineno | Number of lines to move the cursor |
- Returns
- N/A
Definition at line 226 of file cli_input.h.
◆ cli_display_prompt()
static void cli_display_prompt |
( |
int |
t | ) |
|
|
inlinestatic |
Display the prompt on the next line
- Parameters
-
Definition at line 239 of file cli_input.h.
◆ cli_redisplay_line()
static void cli_redisplay_line |
( |
void |
| ) |
|
|
inlinestatic |
Print out the complete line in the Gap Buffer.
- Note
- Uses thread variable this_cli.
- Returns
- N/A
Definition at line 309 of file cli_input.h.
◆ cli_input()
CNDP_API void cli_input |
( |
char * |
str, |
|
|
int |
n, |
|
|
int |
silent |
|
) |
| |
Add a input text string the cli input parser
- Note
- Uses thread variable this_cli.
- Parameters
-
str | Pointer to string to insert |
n | Number of bytes in string |
silent | Set silent mode if non-zero |
- Returns
- N/A
◆ cli_set_prompt()
Set the CLI prompt function pointer
- Parameters
-
prompt | Function pointer to display the prompt |
- Returns
- Return the old prompt function pointer or NULL if one does not exist
◆ cli_set_io()
CNDP_API void cli_set_io |
( |
FILE * |
in, |
|
|
FILE * |
out |
|
) |
| |
Set the I/O file descriptors
- Note
- Uses thread variable this_cli.
- Parameters
-
in | File descriptor for input |
out | File descriptor for output |
- Returns
- N/A
◆ cli_stdin_setup()
CNDP_API int cli_stdin_setup |
( |
void |
| ) |
|
Set the I/O to use stdin/stdout
- Note
- Uses thread variable this_cli.
- Returns
- 0 on success or non-0 on error
◆ cli_stdin_restore()
CNDP_API void cli_stdin_restore |
( |
void |
| ) |
|
Restore the stdin/stdout tty params from setup
- Note
- Uses thread variable this_cli.
- Returns
- N/A
◆ cli_pause()
CNDP_API char cli_pause |
( |
const char * |
msg, |
|
|
const char * |
keys |
|
) |
| |
Pause and wait for input character
- Note
- Uses thread variable this_cli.
- Parameters
-
msg | TODO |
keys | List of keys to force return, if NULL defaults to ESC and q/Q |
- Returns
- character that terminated the pause or zero.
◆ cli_yield_io()
CNDP_API int cli_yield_io |
( |
void |
| ) |
|
return true if calling yield should are enabled.
- Note
- Uses thread variable this_cli.
- Returns
- non-zero if true else 0