summaryrefslogtreecommitdiffstats
path: root/src/food.c
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2022-05-10 21:12:33 +0300
committergramanas <anastasis.gramm2@gmail.com>2022-05-10 21:12:33 +0300
commit16538abf8d1231279133508ba15376145b818518 (patch)
treee19079645f87163f674faa333044330c37374ea9 /src/food.c
parente739c5dccc0faf13cbddacd1950e203305aa4bab (diff)
downloadfoodtools-16538abf8d1231279133508ba15376145b818518.tar.gz
foodtools-16538abf8d1231279133508ba15376145b818518.tar.bz2
foodtools-16538abf8d1231279133508ba15376145b818518.zip
autotools and check testign suite
Diffstat (limited to 'src/food.c')
-rw-r--r--src/food.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/food.c b/src/food.c
index a9c3c6c..6502840 100644
--- a/src/food.c
+++ b/src/food.c
@@ -13,6 +13,7 @@ static struct opts {
int html;
int rcp;
char query[2048];
+ int title;
int eval;
int list;
int hash;
@@ -25,6 +26,7 @@ static struct opts {
.rcp = 0,
.query = "",
.eval = 1,
+ .title = 0,
.list = 0,
.hash = 0,
.search = 0,
@@ -67,6 +69,7 @@ main(int argc, char * argv[])
{"to-rcp", no_argument, 0, 'r'},
{"format", required_argument, 0, 'f'},
{"search", required_argument, 0, 's'},
+ {"title", required_argument, 0, 't'},
{"strict", required_argument, 0, 'S'},
{"hash", required_argument, 0, 'H'},
{"list-ingredients", no_argument, 0, 'l'},
@@ -76,7 +79,7 @@ main(int argc, char * argv[])
int option_index = 0;
- c = getopt_long (argc, argv, "jnlhrwf:s:S:H:",
+ c = getopt_long (argc, argv, "jnlhrwf:s:S:t:H:",
long_options, &option_index);
if (c == -1)
@@ -101,6 +104,10 @@ main(int argc, char * argv[])
else
fprintf(stderr, "invalid format: %s\n", optarg);
break;
+ case 't':
+ opt.title = 1;
+ strcpy(opt.query, optarg);
+ break;
case 's':
opt.search = 1;
strcpy(opt.query, optarg);
@@ -162,6 +169,12 @@ main(int argc, char * argv[])
continue;
}
}
+ if (opt.title) {
+ if (strcmp(r->title, opt.query)) {
+ free_recipe(r);
+ continue;
+ }
+ }
if (opt.search) {
int c;
if (!(c = query_for_items_pbn(r, opt.query, opt.search_strict))) {
@@ -171,7 +184,6 @@ main(int argc, char * argv[])
if (c < 0)
exit(1);
}
-
if (opt.list) {
pprint_items(r);
}