From 722aea1e0fbe4bf2fbb0ca8eec60961ed8d1bd3e Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 9 Oct 2023 13:41:06 +0200 Subject: [PATCH] libsmartcols: (filter) use also rpmatch() for boolean Signed-off-by: Karel Zak --- libsmartcols/src/filter-param.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libsmartcols/src/filter-param.c b/libsmartcols/src/filter-param.c index 31f24bbac6..673c9d9017 100644 --- a/libsmartcols/src/filter-param.c +++ b/libsmartcols/src/filter-param.c @@ -4,6 +4,7 @@ #include #include +#include "rpmatch.h" #include "smartcolsP.h" struct filter_param { @@ -596,9 +597,10 @@ static int string_cast(int type, struct filter_param *n) } case SCOLS_DATA_BOOLEAN: { - bool x = (!str || !*str - || strcasecmp(str, "false") == 0 - || strcasecmp(str, "0") == 0) ? false : true; + bool x = str && *str + && (strcasecmp(str, "1") == 0 + || strcasecmp(str, "true") == 0 + || rpmatch(str) == RPMATCH_YES); n->val.boolean = x; break; } -- 2.47.3