[btr] Split btr_del_node() into two functions.
[paraslash.git] / recv.c
diff --git a/recv.c b/recv.c
index d01dab68847fc93912edb7e9c7a1e873cf11a1e5..c8edb5936e231d493c4f801456eeecb6a2a0da7a 100644 (file)
--- a/recv.c
+++ b/recv.c
@@ -9,6 +9,7 @@
 #include <regex.h>
 #include <sys/types.h>
 #include <dirent.h>
+#include <stdbool.h>
 
 #include "para.h"
 #include "list.h"
 #include "string.h"
 #include "error.h"
 #include "stdout.h"
+#include "buffer_tree.h"
 
-/** the gengetopt args info struct */
-struct recv_args_info conf;
+/** The gengetopt args info struct. */
+static struct recv_args_info conf;
 
 static int loglevel;
 /** Always log to stderr. */
@@ -95,6 +97,9 @@ int main(int argc, char *argv[])
                goto out;
        r_opened = 1;
 
+       if (conf.buffer_tree_given)
+               sot.btrn = btr_new_node("stdout", rn.btrn, NULL, NULL);
+
        stdout_set_defaults(&sot);
        sot.bufp = &rn.buf;
        sot.loaded = &rn.loaded;
@@ -108,6 +113,8 @@ int main(int argc, char *argv[])
 
        ret = schedule(&s);
 out:
+       if (conf.buffer_tree_given)
+               btr_free_node(sot.btrn);
        if (r_opened)
                r->close(&rn);
        if (r)