Browse code

Set default options in config.def.h

John Hawthorn authored on 14/01/2019 05:17:04
Showing 2 changed files

... ...
@@ -11,3 +11,8 @@
11 11
 
12 12
 /* Time (in ms) to wait for additional bytes of an escape sequence */
13 13
 #define KEYTIMEOUT 25
14
+
15
+#define DEFAULT_TTY "/dev/tty"
16
+#define DEFAULT_PROMPT "> "
17
+#define DEFAULT_NUM_LINES 10
18
+#define DEFAULT_WORKERS 0
... ...
@@ -6,6 +6,8 @@
6 6
 
7 7
 #include "options.h"
8 8
 
9
+#include "../config.h"
10
+
9 11
 static const char *usage_str =
10 12
     ""
11 13
     "Usage: fzy [OPTION]...\n"
... ...
@@ -37,15 +39,15 @@ static struct option longopts[] = {{"show-matches", required_argument, NULL, 'e'
37 39
 
38 40
 void options_init(options_t *options) {
39 41
 	/* set defaults */
40
-	options->benchmark = 0;
41
-	options->filter = NULL;
42
-	options->init_search = NULL;
43
-	options->tty_filename = "/dev/tty";
44
-	options->show_scores = 0;
45
-	options->num_lines = 10;
46
-	options->scrolloff = 1;
47
-	options->prompt = "> ";
48
-	options->workers = 0;
42
+	options->benchmark    = 0;
43
+	options->filter       = NULL;
44
+	options->init_search  = NULL;
45
+	options->show_scores  = 0;
46
+	options->scrolloff    = 1;
47
+	options->tty_filename = DEFAULT_TTY;
48
+	options->num_lines    = DEFAULT_NUM_LINES;
49
+	options->prompt       = DEFAULT_PROMPT;
50
+	options->workers      = DEFAULT_WORKERS;
49 51
 }
50 52
 
51 53
 void options_parse(options_t *options, int argc, char *argv[]) {