From 96c65b4936476eca46302ab6ef71d691eb313476 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Sat, 7 Feb 2009 15:19:19 +0100 Subject: [PATCH] Warn users about integers in ~/.tigrc being out of bound --- tig.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tig.c b/tig.c index 97794b0..38daace 100644 --- a/tig.c +++ b/tig.c @@ -1364,6 +1364,10 @@ add_builtin_run_requests(void) * User config file handling. */ +static int config_lineno; +static bool config_errors; +static const char *config_msg; + static struct enum_map color_map[] = { #define COLOR_MAP(name) ENUM_MAP(#name, COLOR_##name) COLOR_MAP(DEFAULT), @@ -1395,9 +1399,13 @@ parse_int(int *opt, const char *arg, int min, int max) { int value = atoi(arg); - if (min <= value && value <= max) + if (min <= value && value <= max) { *opt = value; - return OK; + return OK; + } + + config_msg = "Integer value out of bound"; + return ERR; } static bool @@ -1410,10 +1418,6 @@ set_color(int *color, const char *name) return FALSE; } -static int config_lineno; -static bool config_errors; -static const char *config_msg; - /* Wants: object fgcolor bgcolor [attribute] */ static int option_color_command(int argc, const char *argv[]) -- 2.32.0.93.g670b81a890