From: Jonas Fonseca Date: Sat, 7 Feb 2009 14:19:19 +0000 (+0100) Subject: Warn users about integers in ~/.tigrc being out of bound X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=96c65b4936476eca46302ab6ef71d691eb313476;p=tig.git Warn users about integers in ~/.tigrc being out of bound --- 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[])