Detect base 16 in cmd criteria

Try to detect base 16 numbers given to `con_id` and `id` for command criteria
by setting the base of strtol to 0. This should also detect octal.

This is necessary because mouse bindings now may be serialized as hex as of
5c32de4.
This commit is contained in:
Tony Crisci 2015-05-12 17:04:01 -04:00
parent be2634c91f
commit a74662052a
1 changed files with 2 additions and 2 deletions

View File

@ -335,7 +335,7 @@ void cmd_criteria_add(I3_CMD, char *ctype, char *cvalue) {
if (strcmp(ctype, "con_id") == 0) { if (strcmp(ctype, "con_id") == 0) {
char *end; char *end;
long parsed = strtol(cvalue, &end, 10); long parsed = strtol(cvalue, &end, 0);
if (parsed == LONG_MIN || if (parsed == LONG_MIN ||
parsed == LONG_MAX || parsed == LONG_MAX ||
parsed < 0 || parsed < 0 ||
@ -350,7 +350,7 @@ void cmd_criteria_add(I3_CMD, char *ctype, char *cvalue) {
if (strcmp(ctype, "id") == 0) { if (strcmp(ctype, "id") == 0) {
char *end; char *end;
long parsed = strtol(cvalue, &end, 10); long parsed = strtol(cvalue, &end, 0);
if (parsed == LONG_MIN || if (parsed == LONG_MIN ||
parsed == LONG_MAX || parsed == LONG_MAX ||
parsed < 0 || parsed < 0 ||