Merge commit 'fml/master' into next
[paraslash.git] / amp_filter.c
index 2f05260..63b1b9a 100644 (file)
@@ -1,15 +1,18 @@
 /*
- * Copyright (C) 2008 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2009 Andre Noll <maan@systemlinux.org>
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
 
 /** \file amp_filter.c Paraslash's amplify filter. */
 
+#include <regex.h>
+
 #include "para.h"
 #include "amp_filter.cmdline.h"
 #include "list.h"
 #include "sched.h"
+#include "ggo.h"
 #include "filter.h"
 #include "string.h"
 #include "error.h"
@@ -75,11 +78,9 @@ static void amp_open(struct filter_node *fn)
 
        pad->conf = fn->conf;
        fn->private_data = pad;
-       if (!pad->conf->amp_given && stat_item_values[SI_AMPLIFICATION]) {
-               int i = SI_AMPLIFICATION;
-               char *s = stat_item_values[i] + strlen(status_item_list[i]) + 1;
-               sscanf(s, "%u", &pad->amp);
-       } else
+       if (!pad->conf->amp_given && stat_item_values[SI_AMPLIFICATION])
+               sscanf(stat_item_values[SI_AMPLIFICATION], "%u", &pad->amp);
+       else
                pad->amp = pad->conf->amp_arg;
        fn->bufsize = AMP_CHUNK_SIZE;
        fn->buf = para_malloc(fn->bufsize);
@@ -92,9 +93,15 @@ static void amp_open(struct filter_node *fn)
  */
 void amp_filter_init(struct filter *f)
 {
+       struct amp_filter_args_info dummy;
+
+       amp_cmdline_parser_init(&dummy);
        f->open = amp_open;
        f->close = amp_close;
        f->convert = amp_convert;
-       f->print_help = amp_cmdline_parser_print_help;
        f->parse_config = amp_parse_config;
+       f->help = (struct ggo_help) {
+               .short_help = amp_filter_args_info_help,
+               .detailed_help = amp_filter_args_info_detailed_help
+       };
 }