Skip to content

Commit

Permalink
Warn users about integers in ~/.tigrc being out of bound
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas committed Feb 7, 2009
1 parent 2677b74 commit 96c65b4
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions tig.c
Expand Up @@ -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),
Expand Down Expand Up @@ -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
Expand All @@ -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[])
Expand Down

0 comments on commit 96c65b4

Please sign in to comment.