Free memory, and add a margin
[iomenu.git] / main.h
blob691016c26c371626a9f856498f74b6a7984443b8
1 #include "config.h"
3 #ifndef MAIN_H
4 #define MAIN_H
7 /*
8 * Options from the command line, to pass to each function that need some
9 */
10 typedef struct Opt {
11 int line_numbers;
12 int complete;
13 int print_numbers;
14 char validate_key;
15 char *separator;
16 int lines;
17 char *prompt;
18 } Opt;
22 * Line coming from stdin, wrapped in a header.
24 typedef struct Line {
25 char *content; /* sent as output and matched by input */
26 char *comment; /* displayed at the right of the content */
28 int number; /* set here as order will not change */
29 int matches; /* whether it matches buffer's input */
30 int header; /* whether the line is a header */
32 struct Line *prev; /* doubly linked list structure */
33 struct Line *next;
34 } Line;
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 Line *empty; /* empty line, for when needed */
48 Line *current; /* selected line, highlighted */
49 Line *first; /* boundaries of the linked list */
50 Line *last;
51 } Buffer;
53 #endif