]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - filter.c
First preparations for btr support in para_filter.
[paraslash.git] / filter.c
index 88e2336b0a4b8eed81dd38381427968329673716..20ea1333b758b4302774a1c075980072d6ebf208 100644 (file)
--- a/filter.c
+++ b/filter.c
@@ -6,8 +6,10 @@
 
 /** \file filter.c The stand-alone filter program. */
 
-#include "para.h"
+#include <regex.h>
+#include <stdbool.h>
 
+#include "para.h"
 #include "filter.cmdline.h"
 #include "list.h"
 #include "sched.h"
@@ -151,6 +153,12 @@ static int parse_config(int argc, char *argv[])
        return 1;
 }
 
+/* TODO: support more than one filter, actually parse options */
+static int main_btr(void)
+{
+       return 42;
+}
+
 /**
  * The main function of para_filter.
  *
@@ -168,13 +176,17 @@ int main(int argc, char *argv[])
        int ret;
        static struct sched s;
 
-       stdin_set_defaults(sit);
-       sit->buf = para_malloc(sit->bufsize),
-
        filter_init();
        ret = parse_config(argc, argv);
        if (ret < 0)
                goto out;
+       if (conf.buffer_tree_given) {
+               ret = main_btr();
+               goto out;
+       }
+       stdin_set_defaults(sit);
+       sit->buf = para_malloc(sit->bufsize),
+
        ret = init_filter_chain();
        if (ret < 0)
                goto out;
@@ -186,8 +198,8 @@ int main(int argc, char *argv[])
        sot->input_error = &fc->task.error;
 
        register_task(&sit->task);
-       register_task(&fc->task);
        register_task(&sot->task);
+       register_task(&fc->task);
        s.default_timeout.tv_sec = 1;
        s.default_timeout.tv_usec = 0;
        ret = schedule(&s);