summaryrefslogtreecommitdiffstats
path: root/src/search.c
blob: cf2eab9d7443548a6b41109349184a07a2b60e0b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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;
}