From dbd6366285b23483567f2c1dc814fc9f371c4c64 Mon Sep 17 00:00:00 2001 From: gramanas Date: Mon, 20 Dec 2021 22:52:48 +0200 Subject: merge steps --- src/search.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/search.c (limited to 'src/search.c') diff --git a/src/search.c b/src/search.c new file mode 100644 index 0000000..cf2eab9 --- /dev/null +++ b/src/search.c @@ -0,0 +1,19 @@ +#include "util.h" +#include "search.h" + +/** + * Query recipe `r` for input `s` and return 1 if found 0 otherwise + */ +int +query_for_items(const recipe * r, const char * s, int strict) +{ + for (int i = 0; i < r->in; i++) + if (strict) { + if (!strcmp(r->i[i]->name, s)) + return 1; + } else { + if (strstr(r->i[i]->name, s) != NULL) + return 1; + } + return 0; +} -- cgit v1.2.3