1 exit status on control + C
[iomenu.git] / main.h
blobb868678f6c1935843d7e804cfc410cd4d3f49ecb
1 #include "config.h"
3 #ifndef MAIN_H
4 #define MAIN_H
6 /*
7 * Options from the command line, to pass to each function that need some
8 */
9 typedef struct Opt {
10 int line_numbers;
11 int complete_mode;
12 int print_numbers;
13 char validate_key;
14 char *separator;
15 int lines;
16 char *prompt;
17 } Opt;
20 * Line coming from stdin, wrapped in a header.
22 typedef struct Line {
23 char *content; /* sent as output and matched by input */
24 char *comment; /* displayed at the right of the content */
26 int number; /* set here as order will not change */
27 int matches; /* whether it matches buffer's input */
29 struct Line *prev; /* doubly linked list structure */
30 struct Line *next;
31 } Line;
34 * Group of lines from stdin delimited by a header line.
36 * The header lines are identified by a leading 'HEADER' character,
37 * specified on command line. Each header contains a doubly linked list of
38 * lines.
40 typedef struct Header {
41 int count; /* number of candidates in this header */
43 char *title; /* displayed in bold for each header */
45 struct Header *prev; /* doubly linked list structure */
46 struct Header *next;
48 Line *first; /* first line within the header */
49 } Header;
52 * Buffer containing a doubly linked list of headers
54 typedef struct Buffer {
55 int total; /* total number of line in buffer */
56 int matching; /* number lines matching the input */
58 char input[LINE_SIZE]; /* string from user's keyboard */
59 char *prompt; /* specified from the command line */
61 Header *current_h; /* header containing the selected line */
63 Line *empty; /* empty line, for when needed */
64 Line *current; /* selected line, highlighted */
65 Line *first; /* boundaries of the linked list */
66 Line *last;
67 } Buffer;
69 #endif