mirror of
https://github.com/tmux/tmux.git
synced 2025-09-01 20:57:00 +00:00
Use strtonum instead of atoi.
This commit is contained in:
12
tty-term.c
12
tty-term.c
@ -528,9 +528,10 @@ tty_term_create(struct tty *tty, char *name, char **caps, u_int ncaps,
|
||||
struct options_array_item *a;
|
||||
union options_value *ov;
|
||||
u_int i, j;
|
||||
const char *s, *value;
|
||||
const char *s, *value, *errstr;
|
||||
size_t offset, namelen;
|
||||
char *first;
|
||||
int n;
|
||||
|
||||
log_debug("adding term %s", name);
|
||||
|
||||
@ -564,8 +565,13 @@ tty_term_create(struct tty *tty, char *name, char **caps, u_int ncaps,
|
||||
code->value.string = tty_term_strip(value);
|
||||
break;
|
||||
case TTYCODE_NUMBER:
|
||||
code->type = TTYCODE_NUMBER;
|
||||
code->value.number = atoi(value);
|
||||
n = strtonum(value, 0, INT_MAX, &errstr);
|
||||
if (errstr != NULL)
|
||||
log_debug("%s: %s", ent->name, errstr);
|
||||
else {
|
||||
code->type = TTYCODE_NUMBER;
|
||||
code->value.number = n;
|
||||
}
|
||||
break;
|
||||
case TTYCODE_FLAG:
|
||||
code->type = TTYCODE_FLAG;
|
||||
|
Reference in New Issue
Block a user