From: Tony Crisci Date: Tue, 12 May 2015 21:04:01 +0000 (-0400) Subject: Detect base 16 in cmd criteria X-Git-Tag: 4.10.3~4 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7c2842eae4a63668d510196ee6610f816cb32d39;p=i3%2Fi3 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. --- diff --git a/src/commands.c b/src/commands.c index fd43a693..9d5275dc 100644 --- a/src/commands.c +++ b/src/commands.c @@ -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 ||