|
|
1.1 root 1: #ifndef _READLINE_H
2: #define _READLINE_H
3:
4: /** @file
5: *
6: * Minmal readline
7: *
8: */
9:
10: FILE_LICENCE ( GPL2_OR_LATER );
11:
12: /** A readline history entry */
13: struct readline_history_entry {
14: /** Persistent copy of string */
15: char *string;
16: /** Temporary copy of string
17: *
18: * The temporary copy exists only during the call to
19: * readline().
20: */
21: char *temp;
22: };
23:
24: /** Maximum depth of a readline history buffer
25: *
26: * Must be one less than a power of two.
27: */
28: #define READLINE_HISTORY_MAX_DEPTH ( ( 1 << 3 ) - 1 )
29:
30: /** A readline history buffer */
31: struct readline_history {
32: /** History entries
33: *
34: * This is a circular buffer, with entries in chronological
35: * order. The "next" entry is always empty except during a
36: * call to readline().
37: */
38: struct readline_history_entry entries[READLINE_HISTORY_MAX_DEPTH + 1];
39: /** Position of next entry within buffer
40: *
41: * This is incremented monotonically each time an entry is
42: * added to the buffer.
43: */
44: unsigned int next;
45: /** Current depth within history buffer
46: *
47: * This is valid only during the call to readline()
48: */
49: unsigned int depth;
50: };
51:
52: extern void history_free ( struct readline_history *history );
53: extern char * __malloc readline_history ( const char *prompt,
54: struct readline_history *history );
55: extern char * __malloc readline ( const char *prompt );
56:
57: #endif /* _READLINE_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.