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
[INPUT_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
*current
; /* selected line, highlighted */
50 Line
*first
; /* boundaries of the linked list */
55 void die(const char *);
56 Buffer
* fill_buffer(char *);
57 Line
* parse_line(char *, char *);
58 Line
* add_line(Buffer
*, int, char *, char *, Line
*);
59 int line_match_input(Line
*, char *);
60 void filter_lines(Buffer
*);
61 void print_line(Line
*, int, int);
63 void print_lines(Buffer
*, int, int, int);
64 void update_screen(Buffer
*, int, int);
65 void get_input(Buffer
*, int, int);
66 int do_key(char, Buffer
*);
67 void print_prompt(int, int, char *, int);