iPXE
readline.h
Go to the documentation of this file.
1#ifndef _READLINE_H
2#define _READLINE_H
3
4/** @file
5 *
6 * Minmal readline
7 *
8 */
9
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11FILE_SECBOOT ( PERMITTED );
12
13/** A readline history entry */
15 /** Persistent copy of string */
16 char *string;
17 /** Temporary copy of string
18 *
19 * The temporary copy exists only during the call to
20 * readline().
21 */
22 char *temp;
23};
24
25/** Maximum depth of a readline history buffer
26 *
27 * Must be one less than a power of two.
28 */
29#define READLINE_HISTORY_MAX_DEPTH ( ( 1 << 3 ) - 1 )
30
31/** A readline history buffer */
33 /** History entries
34 *
35 * This is a circular buffer, with entries in chronological
36 * order. The "next" entry is always empty except during a
37 * call to readline().
38 */
40 /** Position of next entry within buffer
41 *
42 * This is incremented monotonically each time an entry is
43 * added to the buffer.
44 */
45 unsigned int next;
46 /** Current depth within history buffer
47 *
48 * This is valid only during the call to readline()
49 */
50 unsigned int depth;
51};
52
53extern void history_free ( struct readline_history *history );
54extern int readline_history ( const char *prompt, const char *prefill,
55 struct readline_history *history,
56 unsigned long timeout, char **line );
57extern char * __malloc readline ( const char *prompt );
58
59#endif /* _READLINE_H */
void timeout(int)
#define __malloc
Declare a pointer returned by a function as a unique memory address as returned by malloc-type functi...
Definition compiler.h:598
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
int prompt(const char *text, unsigned long timeout, int key)
Prompt for keypress.
Definition prompt.c:49
char *__malloc readline(const char *prompt)
Read line from console.
Definition readline.c:350
#define READLINE_HISTORY_MAX_DEPTH
Maximum depth of a readline history buffer.
Definition readline.h:29
void history_free(struct readline_history *history)
Free history buffer.
Definition readline.c:232
int readline_history(const char *prompt, const char *prefill, struct readline_history *history, unsigned long timeout, char **line)
Read line from console (with history)
Definition readline.c:258
A readline history entry.
Definition readline.h:14
char * temp
Temporary copy of string.
Definition readline.h:22
char * string
Persistent copy of string.
Definition readline.h:16
A readline history buffer.
Definition readline.h:32
struct readline_history_entry entries[READLINE_HISTORY_MAX_DEPTH+1]
History entries.
Definition readline.h:39
unsigned int next
Position of next entry within buffer.
Definition readline.h:45
unsigned int depth
Current depth within history buffer.
Definition readline.h:50