audioc.ggo) O="--unamed-opts=command";; \
fsck.ggo) O="--unamed-opts=table";; \
afh.ggo) O="--unamed-opts=audio_file";; \
+ recv.ggo) O="--no-handle-help";; \
filter.ggo) O="--no-handle-help";; \
write.ggo) O="--no-handle-help";; \
esac; \
mkdir -p man/man1
help2man -h --detailed-help -N ./$< > $@
+man/man1/para_recv.1: para_recv
+ mkdir -p man/man1
+ help2man -h --detailed-help -N ./$< > $@
+
man/man1/%.1: %
mkdir -p man/man1
help2man -N ./$< > $@
#include "audiod.cmdline.h"
#include "list.h"
#include "sched.h"
-#include "recv.h"
#include "ggo.h"
+#include "recv.h"
#include "filter.h"
#include "grab_client.cmdline.h"
#include "grab_client.h"
recv_cmdline_objs="recv.cmdline http_recv.cmdline dccp_recv.cmdline"
recv_errlist_objs="http_recv recv_common recv time string net dccp_recv
- fd sched stdout"
+ fd sched stdout ggo"
recv_ldflags=""
receivers=" http dccp"
#include "error.h"
#include "list.h"
#include "sched.h"
+#include "ggo.h"
#include "recv.h"
#include "string.h"
#include "net.h"
*/
void dccp_recv_init(struct receiver *r)
{
+ struct dccp_recv_args_info dummy;
+
+ dccp_recv_cmdline_parser_init(&dummy);
r->shutdown = dccp_shutdown;
r->open = dccp_recv_open;
r->close = dccp_recv_close;
r->pre_select = dccp_recv_pre_select;
r->post_select = dccp_recv_post_select;
r->parse_config = dccp_recv_parse_config;
+ r->help = (struct ggo_help) {
+ .short_help = dccp_recv_args_info_help,
+ .detailed_help = dccp_recv_args_info_detailed_help
+ };
}
-section "options of the dccp receiver"
-option "host" i "ip or host" string default="localhost" optional
-option "port" p "port to connect to" int default="8000" optional
+option "host" i
+"ip or host"
+string default="localhost"
+optional
+details="
+ Both IPv4 and IPv6 addresses are supported.
+"
+
+option "port" p
+"port to connect to"
+int
+default="8000"
+optional
#include "http.h"
#include "list.h"
#include "sched.h"
+#include "ggo.h"
#include "recv.h"
#include "http_recv.cmdline.h"
#include "net.h"
*/
void http_recv_init(struct receiver *r)
{
+ struct http_recv_args_info dummy;
+
+ http_recv_cmdline_parser_init(&dummy);
r->open = http_recv_open;
r->close = http_recv_close;
r->pre_select = http_recv_pre_select;
r->post_select = http_recv_post_select;
r->shutdown = http_shutdown;
r->parse_config = http_recv_parse_config;
+ r->help = (struct ggo_help) {
+ .short_help = http_recv_args_info_help,
+ .detailed_help = http_recv_args_info_detailed_help
+ };
}
-section "options of the http receiver"
-option "host" i "ip or host" string default="localhost" optional
-option "port" p "tcp port to connect to" int default="8000" optional
+option "host" i
+#~~~~~~~~~~~~~~
+"ip or host"
+string
+default="localhost"
+optional
+details="
+ Both IPv4 and IPv6 addresses are supported.
+"
+
+option "port" p
+#~~~~~~~~~~~~~~
+"tcp port to connect to"
+int default="8000"
+optional
#include "ortp.h"
#include "list.h"
#include "sched.h"
+#include "ggo.h"
#include "recv.h"
#include "ortp_recv.cmdline.h"
*/
void ortp_recv_init(struct receiver *r)
{
+ struct ortp_recv_args_info dummy;
+
+ ortp_recv_cmdline_parser_init(&dummy);
r->shutdown = ortp_shutdown;
r->open = ortp_recv_open;
r->close = ortp_recv_close;
r->pre_select = ortp_recv_pre_select;
r->post_select = ortp_recv_post_select;
r->parse_config = ortp_recv_parse_config;
+ r->help = (struct ggo_help) {
+ .short_help = ortp_recv_args_info_help,
+ .detailed_help = ortp_recv_args_info_detailed_help
+ };
ortp_init();
}
-section "ortp options"
-option "host" i "ip or host to receive rtp packets from" string default="224.0.1.38" optional
-option "port" p "udp port." int typestr="portnumber" default="1500" optional
-option "jitter_compensation" j "set ortp's adaptive jitter compensation" int typestr="milliseconds" default="0" optional
+option "host" i
+"ip or host to receive rtp packets from"
+string default="224.0.1.38"
+optional
+details="
+ The default address resoves to DANTZ.MCAST.NET and activates
+ multicast.
+"
+
+option "port" p "udp port"
+int typestr="portnumber"
+default="1500"
+optional
+
+option "jitter_compensation" j
+"set ortp's adaptive jitter compensation"
+int typestr="milliseconds"
+default="0"
+optional
#include "para.h"
#include "list.h"
#include "sched.h"
+#include "ggo.h"
#include "recv.h"
#include "recv.cmdline.h"
#include "fd.h"
/** init array of error codes used by para_recv */
INIT_RECV_ERRLISTS;
-static void *parse_config(int argc, char *argv[], int *receiver_num)
+__noreturn static void print_help_and_die(void)
{
- int i;
+ printf("dsfsfsd\n");
+ int i, d = conf.detailed_help_given;
+ const char **p = d? recv_args_info_detailed_help
+ : recv_args_info_help;
+
+ printf_or_die("%s\n\n", RECV_CMDLINE_PARSER_PACKAGE "-"
+ RECV_CMDLINE_PARSER_VERSION);
+ 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);
+ }
+ exit(0);
+}
+
+static void *parse_config(int argc, char *argv[], int *receiver_num)
+{
if (recv_cmdline_parser(argc, argv, &conf))
return NULL;
HANDLE_VERSION_FLAG("recv", conf);
- if (conf.list_receivers_given) {
- printf("available receivers: ");
- for (i = 0; receivers[i].name; i++)
- printf("%s%s", i? " " : "", receivers[i].name);
- printf("\nTry\n\tpara_recv -r '<receivername> -h'\n"
- "for help on <receivername>.\n");
- exit(EXIT_SUCCESS);
- }
+ if (conf.help_given || conf.detailed_help_given)
+ print_help_and_die();
return check_receiver_arg(conf.receiver_arg, receiver_num);
}
memset(&sot, 0, sizeof(struct stdout_task));
memset(&rn, 0, sizeof(struct receiver_node));
- for (ret = 0; receivers[ret].name; ret++)
+ FOR_EACH_RECEIVER(ret)
receivers[ret].init(&receivers[ret]);
ret = -E_RECV_SYNTAX;
rn.conf = parse_config(argc, argv, &receiver_num);
-option "loglevel" l "set loglevel (0-6)" int typestr="level" default="4" optional
-option "list_receivers" L "print list of available receivers" flag off
-option "receiver" r "Select receiver.
+option "loglevel" l
+#~~~~~~~~~~~~~~~~~~
+"set loglevel (0-6)"
+int typestr="level"
+default="4"
+optional
-Any options for the selected receiver must
-be quoted. Example:
+option "receiver" r
+"Select receiver"
+string typestr="receiver_spec"
+default="http"
+optional
+details="
+ Any options for the selected receiver must
+ be quoted. Example:
- -r 'http -i www.paraslash.org -p 8009'
+ -r 'http -i www.paraslash.org -p 8009'
"
-string typestr="receiver_spec" default="http" optional
* \sa select(2), struct receiver.
*/
void (*post_select)(struct sched *s, struct task *t);
+
+ struct ggo_help help;
};
ORTP_RECEIVER \
{.name = NULL}};
+#define FOR_EACH_RECEIVER(i) for (i = 0; receivers[i].name; i++)
+
void *check_receiver_arg(char *ra, int *receiver_num);
#include "list.h"
#include "sched.h"
+#include "ggo.h"
#include "recv.h"
#include "string.h"