summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2019-01-13 21:17:04 -0800
committerJohn Hawthorn <john@hawthorn.email>2019-02-02 21:40:13 -0800
commit36cd434ad16bf6b6c62ae82853c91355114602cd (patch)
treed1160a7334b2605eb9e787989d7c908dfa3e7774
parent730b6ad7bbd00e90930eefd2d37ce10149ba58bd (diff)
Set default options in config.def.h
-rw-r--r--src/config.def.h5
-rw-r--r--src/options.c20
2 files changed, 16 insertions, 9 deletions
diff --git a/src/config.def.h b/src/config.def.h
index 1bc1ad4..27ef4b1 100644
--- a/src/config.def.h
+++ b/src/config.def.h
@@ -11,3 +11,8 @@
/* Time (in ms) to wait for additional bytes of an escape sequence */
#define KEYTIMEOUT 25
+
+#define DEFAULT_TTY "/dev/tty"
+#define DEFAULT_PROMPT "> "
+#define DEFAULT_NUM_LINES 10
+#define DEFAULT_WORKERS 0
diff --git a/src/options.c b/src/options.c
index 3aa3e63..7e4d414 100644
--- a/src/options.c
+++ b/src/options.c
@@ -6,6 +6,8 @@
#include "options.h"
+#include "../config.h"
+
static const char *usage_str =
""
"Usage: fzy [OPTION]...\n"
@@ -37,15 +39,15 @@ static struct option longopts[] = {{"show-matches", required_argument, NULL, 'e'
void options_init(options_t *options) {
/* set defaults */
- options->benchmark = 0;
- options->filter = NULL;
- options->init_search = NULL;
- options->tty_filename = "/dev/tty";
- options->show_scores = 0;
- options->num_lines = 10;
- options->scrolloff = 1;
- options->prompt = "> ";
- options->workers = 0;
+ options->benchmark = 0;
+ options->filter = NULL;
+ options->init_search = NULL;
+ options->show_scores = 0;
+ options->scrolloff = 1;
+ options->tty_filename = DEFAULT_TTY;
+ options->num_lines = DEFAULT_NUM_LINES;
+ options->prompt = DEFAULT_PROMPT;
+ options->workers = DEFAULT_WORKERS;
}
void options_parse(options_t *options, int argc, char *argv[]) {