summaryrefslogblamecommitdiffstats
path: root/src/search.c
blob: cf2eab9d7443548a6b41109349184a07a2b60e0b (plain) (tree)


















                                                                   
#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;
}