summaryrefslogtreecommitdiffstats
path: root/src/food.c
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2022-05-11 02:17:51 +0300
committergramanas <anastasis.gramm2@gmail.com>2022-05-11 02:17:51 +0300
commit3515199c9e158d4b6fe5d064539bdf288dca7b81 (patch)
tree7c4ac203010c03fefb4d736871b3b3f0a2db3f98 /src/food.c
parent16538abf8d1231279133508ba15376145b818518 (diff)
downloadfoodtools-3515199c9e158d4b6fe5d064539bdf288dca7b81.tar.gz
foodtools-3515199c9e158d4b6fe5d064539bdf288dca7b81.tar.bz2
foodtools-3515199c9e158d4b6fe5d064539bdf288dca7b81.zip
initial library includes
Diffstat (limited to 'src/food.c')
-rw-r--r--src/food.c14
1 files changed, 12 insertions, 2 deletions
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);