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 committed by Michael Stapelberg
parent ee66a8bcde
commit 7c2842eae4
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) {
char *end;
long parsed = strtol(cvalue, &end, 10);
long parsed = strtol(cvalue, &end, 0);
if (parsed == LONG_MIN ||
parsed == LONG_MAX ||
parsed < 0 ||
@ -350,7 +350,7 @@ void cmd_criteria_add(I3_CMD, char *ctype, char *cvalue) {
if (strcmp(ctype, "id") == 0) {
char *end;
long parsed = strtol(cvalue, &end, 10);
long parsed = strtol(cvalue, &end, 0);
if (parsed == LONG_MIN ||
parsed == LONG_MAX ||
parsed < 0 ||