From 3515199c9e158d4b6fe5d064539bdf288dca7b81 Mon Sep 17 00:00:00 2001 From: gramanas Date: Wed, 11 May 2022 02:17:51 +0300 Subject: initial library includes --- src/food.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/food.c') diff --git a/src/food.c b/src/food.c index 6502840..7ee222e 100644 --- a/src/food.c +++ b/src/food.c @@ -13,6 +13,8 @@ static struct opts { int html; int rcp; char query[2048]; + char includes[100][2048]; + int includes_n; int title; int eval; int list; @@ -25,6 +27,8 @@ static struct opts { .html = 0, .rcp = 0, .query = "", + .includes = {""}, + .includes_n = 0, .eval = 1, .title = 0, .list = 0, @@ -68,6 +72,7 @@ main(int argc, char * argv[]) {"to-html", no_argument, 0, 'w'}, {"to-rcp", no_argument, 0, 'r'}, {"format", required_argument, 0, 'f'}, + {"include", required_argument, 0, 'I'}, {"search", required_argument, 0, 's'}, {"title", required_argument, 0, 't'}, {"strict", required_argument, 0, 'S'}, @@ -79,7 +84,7 @@ main(int argc, char * argv[]) int option_index = 0; - c = getopt_long (argc, argv, "jnlhrwf:s:S:t:H:", + c = getopt_long (argc, argv, "jnlhrwf:s:S:t:H:I:", long_options, &option_index); if (c == -1) @@ -104,6 +109,9 @@ main(int argc, char * argv[]) else fprintf(stderr, "invalid format: %s\n", optarg); break; + case 'I': + strcpy(opt.includes[opt.includes_n++], optarg); + break; case 't': opt.title = 1; strcpy(opt.query, optarg); @@ -153,7 +161,9 @@ main(int argc, char * argv[]) } char ** lib = NULL; - int n = collect_library(&lib, argv, argc, optind); + int n = collect_library(&lib, + argv, argc, optind, + opt.includes, opt.includes_n); for (int i = 0; i < n; i++) { recipe * r = parse(lib[i], NULL); -- cgit v1.2.3