/*
- * Copyright (C) 2005-2009 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2005-2013 Andre Noll <maan@systemlinux.org>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
/** \file filter.c The stand-alone filter program. */
#include <regex.h>
-#include <stdbool.h>
#include "para.h"
#include "filter.cmdline.h"
#include "stdin.h"
#include "stdout.h"
#include "error.h"
+#include "version.h"
/** The list of all status items used by para_{server,audiod,gui}. */
const char *status_item_list[] = {STATUS_ITEM_ARRAY};
sit->btrn = btr_new_node(&(struct btr_node_description)
EMBRACE(.name = "stdin"));
stdin_set_defaults(sit);
- register_task(&sit->task);
+ register_task(&s, &sit->task);
fns = para_malloc(conf.filter_given * sizeof(*fns));
for (i = 0, parent = sit->btrn; i < conf.filter_given; i++) {
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;
+ if (f->new_post_select) {
+ fn->task.new_post_select = f->new_post_select;
+ fn->task.post_select = NULL;
+ } else {
+ fn->task.new_post_select = NULL;
+ fn->task.post_select = f->post_select;
+ }
f->open(fn);
- register_task(&fn->task);
+ register_task(&s, &fn->task);
parent = fn->btrn;
}
sot->btrn = btr_new_node(&(struct btr_node_description)
EMBRACE(.name = "stdout", .parent = parent));
stdout_set_defaults(sot);
- register_task(&sot->task);
+ register_task(&s, &sot->task);
s.default_timeout.tv_sec = 1;
s.default_timeout.tv_usec = 0;
f = filters + fn->filter_num;
if (f->close)
f->close(fn);
- btr_free_node(fn->btrn);
- free(fn->conf);
+ btr_remove_node(&fn->btrn);
+ if (f->free_config)
+ f->free_config(fn->conf);
free(fn);
}
free(fns);
- btr_free_node(sit->btrn);
- btr_free_node(sot->btrn);
+ btr_remove_node(&sit->btrn);
+ btr_remove_node(&sot->btrn);
out:
if (ret < 0)
PARA_EMERG_LOG("%s\n", para_strerror(-ret));