From 36cd434ad16bf6b6c62ae82853c91355114602cd Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Sun, 13 Jan 2019 21:17:04 -0800 Subject: Set default options in config.def.h --- src/config.def.h | 5 +++++ src/options.c | 20 +++++++++++--------- 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[]) { -- cgit v1.2.3