CNDP  22.08.0
cli_history.h File Reference
#include <sys/queue.h>
#include <stdint.h>
#include "cli.h"
#include "cne_common.h"

Go to the source code of this file.

Enumerations

enum  { }
 

Functions

CNDP_API struct cli_hist * cli_hist_alloc (void)
 
CNDP_API void cli_hist_free (struct cli_hist *hist)
 
CNDP_API void cli_history_add (char *line)
 
CNDP_API void cli_history_del (void)
 
CNDP_API char * cli_history_line (int lineno)
 
void cli_history_clear (void)
 
CNDP_API void cli_history_delete (void)
 
CNDP_API int cli_set_history (uint32_t nb_hist)
 
CNDP_API char * cli_history_prev (void)
 
CNDP_API char * cli_history_next (void)
 
CNDP_API void cli_history_reset (void)
 
CNDP_API void cli_history_dump (void)
 

Detailed Description

CNE Command line history

Definition in file cli_history.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
CLI_NO_HISTORY 

Use the default history count

Definition at line 24 of file cli_history.h.

Function Documentation

◆ cli_hist_alloc()

CNDP_API struct cli_hist* cli_hist_alloc ( void  )

Create and allocate a history structure

Note
Uses the thread variable this_cli
Returns
pointer to history structure or NULL on error

◆ cli_hist_free()

CNDP_API void cli_hist_free ( struct cli_hist *  hist)

Free a CLI history structure and other memory

Note
Uses the thread variable this_cli
Parameters
histPointer to the history structure
Returns
N/A

◆ cli_history_add()

CNDP_API void cli_history_add ( char *  line)

Add line to history at the end

Note
Uses the thread variable this_cli
Parameters
linePointer to string to add to the history list
Returns
N/A

◆ cli_history_del()

CNDP_API void cli_history_del ( void  )

Delete a history entry

Note
Uses the thread variable this_cli
Returns
N/A

◆ cli_history_line()

CNDP_API char* cli_history_line ( int  lineno)

Return the history command from line number

Note
Uses the thread variable this_cli
Parameters
linenoThe line number of the command to return.
Returns
Pointer to line or NULL on error

◆ cli_history_clear()

void cli_history_clear ( void  )

Clear all of the history lines from the list

Note
Uses the thread variable this_cli
Returns
N/A

◆ cli_history_delete()

CNDP_API void cli_history_delete ( void  )

Delete the history lines and structure

Note
Uses the thread variable this_cli
Returns
N/A

◆ cli_set_history()

CNDP_API int cli_set_history ( uint32_t  nb_hist)

Set the number of lines max in the history list

Parameters
nb_histNumber of lines max in the history list
Returns
0 is ok, -1 is error

◆ cli_history_prev()

CNDP_API char* cli_history_prev ( void  )

Return the previous history line

Note
Uses the thread variable this_cli
Returns
pointer to the previous history line wrap if needed

◆ cli_history_next()

CNDP_API char* cli_history_next ( void  )

Return the next history line

Returns
pointer to the next history line wrap if needed

◆ cli_history_reset()

CNDP_API void cli_history_reset ( void  )

Reset the current history pointer to the last entry.

Note
Uses the thread variable this_cli

◆ cli_history_dump()

CNDP_API void cli_history_dump ( void  )

Add the default set of directories and commands

Note
Uses the thread variable this_cli
Returns
0 is ok, -1 is error