vss: Use the stripped header also at stream start.
[paraslash.git] / filter.c
index 8ebceb4..1d938c4 100644 (file)
--- a/filter.c
+++ b/filter.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005-2009 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2005-2011 Andre Noll <maan@systemlinux.org>
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
@@ -87,6 +87,8 @@ static int parse_config(int argc, char *argv[])
                if (filter_cmdline_parser_config_file(cf, &conf, &params))
                        return -E_FILTER_SYNTAX;
        }
+       if (!conf.filter_given)
+               return -E_NO_FILTERS;
        return 1;
 }
 
@@ -114,7 +116,8 @@ int main(int argc, char *argv[])
        ret = parse_config(argc, argv);
        if (ret < 0)
                goto out;
-       sit->btrn = btr_new_node("stdin", NULL, NULL, NULL);
+       sit->btrn = btr_new_node(&(struct btr_node_description)
+               EMBRACE(.name = "stdin"));
        stdin_set_defaults(sit);
        register_task(&sit->task);
 
@@ -133,14 +136,17 @@ int main(int argc, char *argv[])
                f = filters + fn->filter_num;
                sprintf(fn->task.status, "%s", f->name);
                PARA_DEBUG_LOG("filter #%d: %s\n", i, f->name);
-               fn->btrn = btr_new_node(f->name, parent, f->execute, fn);
+               fn->btrn = btr_new_node(&(struct btr_node_description)
+                       EMBRACE(.name = f->name, .parent = parent,
+                       .handler = f->execute, .context = fn));
                fn->task.pre_select = f->pre_select;
                fn->task.post_select = f->post_select;
                f->open(fn);
                register_task(&fn->task);
                parent = fn->btrn;
        }
-       sot->btrn = btr_new_node("stdout", parent, NULL, NULL);
+       sot->btrn = btr_new_node(&(struct btr_node_description)
+               EMBRACE(.name = "stdout", .parent = parent));
        stdout_set_defaults(sot);
        register_task(&sot->task);
 
@@ -153,7 +159,8 @@ out_cleanup:
                struct filter_node *fn = fns[i];
 
                f = filters + fn->filter_num;
-               f->close(fn);
+               if (f->close)
+                       f->close(fn);
                btr_free_node(fn->btrn);
                free(fn->conf);
                free(fn);