Make functions for printing recv/filter/write help public.
authorAndre Noll <maan@systemlinux.org>
Sun, 7 Dec 2008 10:16:43 +0000 (11:16 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 7 Dec 2008 10:16:43 +0000 (11:16 +0100)
So that these functions can also be used by audiod.

filter.c
filter.h
filter_common.c
recv.c
recv.h
recv_common.c
write.c
write_common.c
write_common.h

index 0ffb723..d67aeae 100644 (file)
--- a/filter.c
+++ b/filter.c
@@ -97,7 +97,7 @@ err:
 
 __noreturn static void print_help_and_die(void)
 {
-       int i, d = conf.detailed_help_given;
+       int d = conf.detailed_help_given;
        const char **p = d? filter_args_info_detailed_help
                : filter_args_info_help;
 
@@ -106,20 +106,7 @@ __noreturn static void print_help_and_die(void)
        printf_or_die("%s\n\n", filter_args_info_usage);
        for (; *p; p++)
                printf_or_die("%s\n", *p);
-
-       printf_or_die("\nAvailable filters: \n\t");
-       FOR_EACH_SUPPORTED_FILTER(i)
-               printf_or_die("%s%s", i? " " : "", filters[i].name);
-       printf_or_die("\n\n");
-
-       FOR_EACH_SUPPORTED_FILTER(i) {
-               struct filter *f = filters + i;
-
-               if (!f->help.short_help)
-                       continue;
-               printf_or_die("Options for %s:\n", f->name);
-               ggo_print_help(&f->help, d);
-       }
+       print_filter_helps(d);
        exit(0);
 }
 
index 0c3ac70..c2a6310 100644 (file)
--- a/filter.h
+++ b/filter.h
@@ -204,7 +204,7 @@ void close_filters(struct filter_chain *fc);
 void filter_init(struct filter *all_filters);
 int check_filter_arg(char *filter_arg, void **conf);
 void filter_pre_select(__a_unused struct sched *s, struct task *t);
-
+void print_filter_helps(int detailed);
 
 static inline void write_int16_host_endian(char *buf, int val)
 {
index 45f5760..a39eefd 100644 (file)
@@ -263,3 +263,22 @@ int check_filter_arg(char *fa, void **conf)
        return -E_UNSUPPORTED_FILTER;
 }
 
+void print_filter_helps(int detailed)
+{
+       int i;
+
+       printf_or_die("\nAvailable filters: \n\t");
+       FOR_EACH_SUPPORTED_FILTER(i)
+               printf_or_die("%s%s", i? " " : "", filters[i].name);
+       printf_or_die("\n\n");
+
+       FOR_EACH_SUPPORTED_FILTER(i) {
+               struct filter *f = filters + i;
+
+               if (!f->help.short_help)
+                       continue;
+               printf_or_die("Options for %s:\n", f->name);
+               ggo_print_help(&f->help, detailed);
+       }
+
+}
diff --git a/recv.c b/recv.c
index 1df476f..52935a8 100644 (file)
--- a/recv.c
+++ b/recv.c
@@ -30,8 +30,7 @@ INIT_RECV_ERRLISTS;
 
 __noreturn static void print_help_and_die(void)
 {
-       printf("dsfsfsd\n");
-       int i, d = conf.detailed_help_given;
+       int d = conf.detailed_help_given;
        const char **p = d? recv_args_info_detailed_help
                : recv_args_info_help;
 
@@ -40,19 +39,7 @@ __noreturn static void print_help_and_die(void)
        printf_or_die("%s\n\n", recv_args_info_usage);
        for (; *p; p++)
                printf_or_die("%s\n", *p);
-
-       printf_or_die("\nAvailable receivers: \n\t");
-       FOR_EACH_RECEIVER(i)
-               printf_or_die("%s%s", i? " " : "", receivers[i].name);
-       printf_or_die("\n\n");
-       FOR_EACH_RECEIVER(i) {
-               struct receiver *r = receivers + i;
-
-               if (!r->help.short_help)
-                       continue;
-               printf_or_die("Options for %s:\n", r->name);
-               ggo_print_help(&r->help, d);
-       }
+       print_receiver_helps(d);
        exit(0);
 }
 
diff --git a/recv.h b/recv.h
index f8b1529..3aed018 100644 (file)
--- a/recv.h
+++ b/recv.h
@@ -135,3 +135,4 @@ extern struct receiver receivers[];
 #define FOR_EACH_RECEIVER(i) for (i = 0; receivers[i].name; i++)
 
 void *check_receiver_arg(char *ra, int *receiver_num);
+void print_receiver_helps(int detailed);
index 03f569f..5f2412b 100644 (file)
@@ -84,3 +84,21 @@ void *check_receiver_arg(char *ra, int *receiver_num)
        PARA_ERROR_LOG("receiver not found\n");
        return NULL;
 }
+
+void print_receiver_helps(int detailed)
+{
+       int i;
+
+       printf_or_die("\nAvailable receivers: \n\t");
+       FOR_EACH_RECEIVER(i)
+               printf_or_die("%s%s", i? " " : "", receivers[i].name);
+       printf_or_die("\n\n");
+       FOR_EACH_RECEIVER(i) {
+               struct receiver *r = receivers + i;
+
+               if (!r->help.short_help)
+                       continue;
+               printf_or_die("Options for %s:\n", r->name);
+               ggo_print_help(&r->help, detailed);
+       }
+}
diff --git a/write.c b/write.c
index 6e78e77..9b7a921 100644 (file)
--- a/write.c
+++ b/write.c
@@ -163,7 +163,7 @@ out:
 
 __noreturn static void print_help_and_die(void)
 {
-       int i, d = conf.detailed_help_given;
+       int d = conf.detailed_help_given;
        const char **p = d? write_args_info_detailed_help
                : write_args_info_help;
 
@@ -172,19 +172,7 @@ __noreturn static void print_help_and_die(void)
        printf_or_die("%s\n\n", write_args_info_usage);
        for (; *p; p++)
                printf_or_die("%s\n", *p);
-
-       printf_or_die("\nAvailable writers: \n\t");
-       FOR_EACH_WRITER(i)
-               printf_or_die("%s%s", i? " " : "", writer_names[i]);
-       printf_or_die("\n\n");
-       FOR_EACH_WRITER(i) {
-               struct writer *w = writers + i;
-
-               if (!w->help.short_help)
-                       continue;
-               printf_or_die("Options for %s:\n", writer_names[i]);
-               ggo_print_help(&w->help, d);
-       }
+       print_writer_helps(d);
        exit(0);
 }
 
index d66b20c..5896d91 100644 (file)
@@ -211,3 +211,21 @@ struct writer_node_group *setup_default_wng(void)
        wng->writer_nodes[0].conf = writers[DEFAULT_WRITER].parse_config("");
        return wng;
 }
+
+void print_writer_helps(int detailed)
+{
+       int i;
+
+       printf_or_die("\nAvailable writers: \n\t");
+       FOR_EACH_WRITER(i)
+               printf_or_die("%s%s", i? " " : "", writer_names[i]);
+       printf_or_die("\n\n");
+       FOR_EACH_WRITER(i) {
+               struct writer *w = writers + i;
+
+               if (!w->help.short_help)
+                       continue;
+               printf_or_die("Options for %s:\n", writer_names[i]);
+               ggo_print_help(&w->help, detailed);
+       }
+}
index 8d94d2a..7f0bbc5 100644 (file)
@@ -12,3 +12,4 @@ struct writer_node_group *wng_new(unsigned num_writers);
 void init_supported_writers(void);
 void *check_writer_arg(const char *wa, int *writer_num);
 struct writer_node_group *setup_default_wng(void);
+void print_writer_helps(int detailed);