iPXE
|
Minmal readline. More...
Go to the source code of this file.
Data Structures | |
struct | readline_history_entry |
A readline history entry. More... | |
struct | readline_history |
A readline history buffer. More... | |
Macros | |
#define | READLINE_HISTORY_MAX_DEPTH ( ( 1 << 3 ) - 1 ) |
Maximum depth of a readline history buffer. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
void | history_free (struct readline_history *history) |
Free history buffer. More... | |
int | readline_history (const char *prompt, const char *prefill, struct readline_history *history, unsigned long timeout, char **line) |
Read line from console (with history) More... | |
char *__malloc | readline (const char *prompt) |
Read line from console. More... | |
Minmal readline.
Definition in file readline.h.
#define READLINE_HISTORY_MAX_DEPTH ( ( 1 << 3 ) - 1 ) |
Maximum depth of a readline history buffer.
Must be one less than a power of two.
Definition at line 28 of file readline.h.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
void history_free | ( | struct readline_history * | history | ) |
Free history buffer.
history | History buffer |
Definition at line 231 of file readline.c.
References assert(), readline_history::entries, free, NULL, readline_history_entry::string, and readline_history_entry::temp.
Referenced by shell().
int readline_history | ( | const char * | prompt, |
const char * | prefill, | ||
struct readline_history * | history, | ||
unsigned long | timeout, | ||
char ** | line | ||
) |
Read line from console (with history)
prompt | Prompt string |
prefill | Prefill string, or NULL for no prefill |
history | History buffer, or NULL for no history |
timeout | Timeout period, in ticks (0=indefinite) |
line | Line read from console (excluding terminating newline) |
rc | Return status code |
The returned line is allocated with malloc(); the caller must eventually call free() to release the storage.
Definition at line 257 of file readline.c.
References assert(), CR, CTRL_C, done, ECANCELED, edit_string(), error, ETIMEDOUT, free, getkey(), history_append(), history_cleanup(), history_move(), init_editstring(), key, KEY_DOWN, KEY_UP, LF, memset(), NULL, printf(), prompt(), putchar(), rc, replace_string(), string, sync_console(), and timeout().
Referenced by readline(), and shell().
char* __malloc readline | ( | const char * | prompt | ) |
Read line from console.
prompt | Prompt string |
line | Line read from console (excluding terminating newline) |
The returned line is allocated with malloc(); the caller must eventually call free() to release the storage.
Definition at line 349 of file readline.c.
References NULL, prompt(), and readline_history().