From 7c2842eae4a63668d510196ee6610f816cb32d39 Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Tue, 12 May 2015 17:04:01 -0400 Subject: [PATCH] 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. --- src/commands.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 ||