fsck.ggo) O="--unamed-opts=table";; \
afh.ggo) O="--unamed-opts=audio_file";; \
filter.ggo) O="--no-handle-help";; \
+ write.ggo) O="--no-handle-help";; \
esac; \
if test $< != fsck.ggo; then O="$$O --conf-parser "; fi; \
gengetopt $$O \
mkdir -p man/man1
help2man -h --detailed-help -N ./$< > $@
+man/man1/para_write.1: para_write
+ mkdir -p man/man1
+ help2man -h --detailed-help -N ./$< > $@
+
man/man1/%.1: %
mkdir -p man/man1
help2man -N ./$< > $@
#include "string.h"
#include "list.h"
#include "sched.h"
+#include "ggo.h"
#include "write.h"
#include "alsa_write.cmdline.h"
#include "error.h"
*/
void alsa_write_init(struct writer *w)
{
+ struct alsa_write_args_info dummy;
+
+ alsa_cmdline_parser_init(&dummy);
w->open = alsa_open;
w->close = alsa_close;
w->pre_select = alsa_write_pre_select;
w->post_select = alsa_write_post_select;
w->parse_config = alsa_parse_config;
w->shutdown = NULL; /* nothing to do */
+ w->help = (struct ggo_help) {
+ .purpose = alsa_write_args_info_purpose,
+ .usage = alsa_write_args_info_usage,
+ .short_help = alsa_write_args_info_help,
+ .detailed_help = alsa_write_args_info_detailed_help
+ };
}
-section "alsa options"
-######################
-
option "device" d
#~~~~~~~~~~~~~~~~
"set PCM device"
- string typestr="device"
- default="default"
- optional
+string typestr="device"
+default="default"
+optional
+details="
+ On systems with dmix, a better choice than the default
+ value might be to use \"plug:swmix\".
+"
option "channels" c
#~~~~~~~~~~~~~~~~~~
-"number of channels (only necessary for raw
-audio)"
-
- int typestr="num"
- default="2"
- optional
+"specify number of channels"
+int typestr="num"
+default="2"
+optional
+details="
+ This option is only necessary for playing raw audio with
+ para_write. In all other cases (plaing wav files with
+ para_write or using this writer with para_audiod), the number
+ of channels will be obtained from other resources.
+"
option "samplerate" s
#~~~~~~~~~~~~~~~~~~~~~
-
-"force given sample rate (only necessary for
-raw audio)"
-
- int typestr="num"
- default="44100"
- optional
+"force given sample rate"
+int typestr="num"
+default="44100"
+optional
+details="
+ Again, it is only necessary to specify this when playing raw
+ audio with para_write.
+"
server_audio_formats=" mp3"
write_cmdline_objs="write.cmdline file_write.cmdline"
-write_errlist_objs="write write_common file_write time fd string sched stdin"
+write_errlist_objs="write write_common file_write time fd string sched stdin ggo"
write_ldflags=""
writers=" file"
default_writer="FILE_WRITE"
#include "para.h"
#include "list.h"
#include "sched.h"
+#include "ggo.h"
#include "write.h"
#include "string.h"
#include "fd.h"
/** the init function of the file writer */
void file_write_init(struct writer *w)
{
+ struct file_write_args_info dummy;
+
+ file_cmdline_parser_init(&dummy);
w->open = file_write_open;
w->pre_select = file_write_pre_select;
w->post_select = file_write_post_select;
w->parse_config = file_write_parse_config;
w->close = file_write_close;
w->shutdown = NULL; /* nothing to do */
+ w->help = (struct ggo_help) {
+ .purpose = file_write_args_info_purpose,
+ .usage = file_write_args_info_usage,
+ .short_help = file_write_args_info_help,
+ .detailed_help = file_write_args_info_detailed_help
+ };
}
-section "file writer options"
-
option "filename" f
#~~~~~~~~~~~~~~~~~~
-
-"select output file name. Defaults to a
-random filename in ~/.paraslash."
-
- string typestr="filename"
- optional
+"specify output file name"
+string typestr="filename"
+optional
+details="
+ Defaults to a random filename in ~/.paraslash.
+"
#include "write.cmdline.h"
#include "list.h"
#include "sched.h"
+#include "ggo.h"
#include "stdin.h"
#include "write.h"
#include "write_common.h"
struct writer_node_group *g = NULL;
struct initial_delay_task *idt = &the_initial_delay_task;
- if (conf.list_writers_given) {
- char *msg = NULL;
- FOR_EACH_WRITER(i) {
- char *tmp = make_message("%s%s%s",
- i? msg : "",
- i? " " : "",
- writer_names[i]);
- free(msg);
- msg = tmp;
- }
- fprintf(stderr, "%s\n", msg);
- free(msg);
- exit(EXIT_SUCCESS);
- }
if (conf.start_time_given) {
long unsigned sec, usec;
if (sscanf(conf.start_time_arg, "%lu:%lu",
return NULL;
}
+__noreturn static void print_help_and_die(void)
+{
+ int i, d = conf.detailed_help_given;
+ const char **p = d? write_args_info_detailed_help
+ : write_args_info_help;
+
+ printf_or_die("%s\n\n", WRITE_CMDLINE_PARSER_PACKAGE "-"
+ WRITE_CMDLINE_PARSER_VERSION);
+ 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);
+ }
+ exit(0);
+}
+
/**
* Para_write's main function.
*
struct check_wav_task *cwt = &the_check_wav_task;
struct initial_delay_task *idt = &the_initial_delay_task;
+ init_supported_writers();
write_cmdline_parser(argc, argv, &conf);
HANDLE_VERSION_FLAG("write", conf);
- init_supported_writers();
+ if (conf.help_given || conf.detailed_help_given)
+ print_help_and_die();
wng = check_args();
if (!wng)
-section "general options"
-#########################
-
-option "list_writers" L
-#~~~~~~~~~~~~~~~~~~~~~~
-"print available writers and exit"
-
- flag off
-
option "loglevel" l
#~~~~~~~~~~~~~~~~~~
"set loglevel (0-6)"
-
- int typestr="level"
- default="4"
- optional
+int typestr="level"
+default="4"
+optional
option "bufsize" b
#~~~~~~~~~~~~~~~~~
"input buffer size"
-
- int typestr="kilobytes"
- default="64"
- optional
+int typestr="kilobytes"
+default="64"
+optional
option "writer" w
#~~~~~~~~~~~~~~~~
-
-"select stream writer
-may be give multiple times. The same writer
-may be specified more than once"
-
- string typestr="name"
- default="alsa (file if alsa is unsupported)"
- optional
- multiple
+"select stream writer"
+string typestr="name"
+default="alsa (file if alsa is unsupported)"
+optional
+multiple
+details="
+ May be give multiple times. The same writer may be specified
+ more than once.
+"
option "start_time" t
#~~~~~~~~~~~~~~~~~~~~
-"start playback at given time which must be
-in a:b format where a denotes seconds and b
-denotes microseconds since the epoch"
-
- string typestr="timeval"
- optional
+"defer playback"
+string typestr="timeval"
+optional
+details="
+ Start playback at given time which must be in a:b format where
+ a denotes seconds and b denotes microseconds since the epoch.
+"
* This is a optional function pointer used for cleaning up.
*/
void (*shutdown)(struct writer_node *);
+ struct ggo_help help;
};
/**
#include "string.h"
#include "list.h"
#include "sched.h"
+#include "ggo.h"
#include "write.h"
#include "error.h"