6 * Line coming from stdin, wrapped in a header.
9 char *content
; /* sent as output and matched by input */
10 char *comment
; /* displayed at the right of the content */
12 int number
; /* set here as order will not change */
13 int matches
; /* whether it matches buffer's input */
15 struct Line
*prev
; /* doubly linked list structure */
20 * Group of lines from stdin delimited by a header line.
22 * The header lines are identified by a leading 'HEADER' character,
23 * specified on command line. Each header contains a doubly linked list of
26 typedef struct Header
{
27 int count
; /* number of candidates in this header */
29 char *title
; /* displayed in bold for each header */
31 struct Header
*prev
; /* doubly linked list structure */
34 Line
*first
; /* first line within the header */
38 * Buffer containing a doubly linked list of headers
40 typedef struct Buffer
{
41 int total
; /* total number of line in buffer */
42 int matching
; /* number lines matching the input */
44 char input
[LINE_SIZE
]; /* string from user's keyboard */
45 char *prompt
; /* specified from the command line */
47 Header
*current_h
; /* header containing the selected line */
49 Line
*empty
; /* empty line, for when needed */
50 Line
*current
; /* selected line, highlighted */
51 Line
*first
; /* boundaries of the linked list */
56 void die(const char *);
59 Buffer
* fill_buffer(char *);
60 Line
* parse_line(char *, char *);
61 Line
* add_line(Buffer
*, int, char *, char *, Line
*);
62 Line
* matching_next(Line
*);
65 int line_match_input(Line
*, char *);
66 void filter_lines(Buffer
*);
69 char * expand_tabs(char *);
70 void print_line(Line
*, int, int);
72 void print_lines(Buffer
*, int, int, int);
73 void update_screen(Buffer
*, int, int, int);
76 struct termios
terminal_set(int);
79 void get_input(Buffer
*, int, int, int);
80 int do_key(char, Buffer
*);
81 void do_jump(Buffer
*, int);
82 void do_print_selection(Buffer
*);
83 void do_remove_word_input(Buffer
*);
84 void do_add_character(Buffer
*, char);
85 void print_prompt(Buffer
*, int);