From: Karel Zak Date: Mon, 9 Oct 2023 11:41:06 +0000 (+0200) Subject: libsmartcols: (filter) use also rpmatch() for boolean X-Git-Tag: v2.40-rc1~151^2~37 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=722aea1e0fbe4bf2fbb0ca8eec60961ed8d1bd3e;p=thirdparty%2Futil-linux.git libsmartcols: (filter) use also rpmatch() for boolean Signed-off-by: Karel Zak --- 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; }