- goto out;
- open_filters();
- ib = fci->inbuf;
- ob = fci->outbuf;
- il = fci->in_loaded;
- ol = fci->out_loaded;
- PARA_DEBUG_LOG("ib %p in, ob: %p\n", ib, ob);
-again:
- if (*il < INBUF_SIZE && !eof) {
- ret = read(STDIN_FILENO, ib + *il, INBUF_SIZE - *il);
- PARA_DEBUG_LOG("read %d/%zd\n", ret, INBUF_SIZE - *il);
- if (ret < 0)
- goto out;
- if (!ret)
- eof = 1;
- *il += ret;
+ goto free_lpr;
+ sit->btrn = btr_new_node(&(struct btr_node_description)
+ EMBRACE(.name = "stdin"));
+ stdin_task_register(sit, &s);
+
+ fns = para_malloc(OPT_GIVEN(FILTER) * sizeof(*fns));
+ for (i = 0, parent = sit->btrn; i < OPT_GIVEN(FILTER); i++) {
+ const char *fa = lls_string_val(i, OPT_RESULT(FILTER));
+ const char *name;
+ struct filter_node *fn;
+ struct task_info ti;
+
+ fn = fns[i] = para_calloc(sizeof(*fn));
+ fn->filter_num = filter_setup(fa, &fn->conf, &filter_lpr);
+ name = filter_name(fn->filter_num);
+ fn->lpr = filter_lpr;
+ PARA_DEBUG_LOG("filter #%d: %s\n", i, name);
+ f = filter_get(fn->filter_num);
+ fn->btrn = btr_new_node(&(struct btr_node_description)
+ EMBRACE(.name = name, .parent = parent,
+ .handler = f->execute, .context = fn));
+ ti.name = name;
+ ti.pre_select = f->pre_select;
+ ti.post_select = f->post_select;
+ ti.context = fn;
+ if (f->open)
+ f->open(fn);
+ fn->task = task_register(&ti, &s);
+ parent = fn->btrn;