cosmetics
[paraslash.git] / filter.c
index cfa2e94fad98aa255d38bb22dc9906f6fe863c3f..0d1c2e243b4e21c221a5abcd23a4f93fa1dce228 100644 (file)
--- a/filter.c
+++ b/filter.c
@@ -30,8 +30,6 @@
 
 INIT_FILTER_ERRLISTS;
 
-#define INBUF_SIZE 32 * 1024
-
 static struct stdin_task stdin_task_struct;
 static struct stdin_task *sit = &stdin_task_struct;
 static struct filter_chain filter_chain_struct;
@@ -39,7 +37,7 @@ static struct filter_chain *fc = &filter_chain_struct;
 static struct stdout_task stdout_task_struct;
 static struct stdout_task *sot = &stdout_task_struct;
 
-struct gengetopt_args_info conf;
+struct filter_args_info conf;
 
 __printf_2_3 void para_log(int ll, const char* fmt,...)
 {
@@ -115,7 +113,7 @@ static int parse_config(int argc, char *argv[])
        struct stat statbuf;
        int i;
 
-       if (cmdline_parser(argc, argv, &conf))
+       if (filter_cmdline_parser(argc, argv, &conf))
                return -E_FILTER_SYNTAX;
        if (!cf) {
                char *home = para_homedir();
@@ -123,7 +121,7 @@ static int parse_config(int argc, char *argv[])
                free(home);
        }
        if (!stat(cf, &statbuf)) {
-               if (cmdline_parser_configfile(cf, &conf, 0, 0, 0))
+               if (filter_cmdline_parser_configfile(cf, &conf, 0, 0, 0))
                        return -E_FILTER_SYNTAX;
        }
        if (!conf.list_filters_given)
@@ -142,7 +140,6 @@ int main(int argc, char *argv[])
        int ret;
        struct sched s;
 
-       init_sched();
        stdin_set_defaults(sit);
        sit->buf = para_malloc(sit->bufsize),
 
@@ -155,7 +152,6 @@ int main(int argc, char *argv[])
                goto out;
 
        stdout_set_defaults(sot);
-       PARA_EMERG_LOG("fc->output_eof: %d\n", *fc->output_eof);
        sot->buf = fc->outbuf;
        sot->loaded = fc->out_loaded;
        sot->input_eof = &fc->eof;
@@ -165,12 +161,11 @@ int main(int argc, char *argv[])
        register_task(&sit->task);
        s.default_timeout.tv_sec = 1;
        s.default_timeout.tv_usec = 0;
-       PARA_EMERG_LOG("fc->output_eof: %d\n", *fc->output_eof);
        ret = sched(&s);
 out:
        free(sit->buf);
+       close_filters(fc);
        if (ret < 0)
                PARA_EMERG_LOG("%s\n", PARA_STRERROR(-ret));
-       close_filters(fc);
        return ret < 0? EXIT_FAILURE : EXIT_SUCCESS;
 }