]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Use symbolic names for loglevels and clean up the ggo mess.
authorAndre Noll <maan@systemlinux.org>
Sun, 18 Jan 2009 01:25:42 +0000 (02:25 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 18 Jan 2009 01:25:42 +0000 (02:25 +0100)
We now use m4 to generate the ggo files, which allows to get rid of
a lot of duplicated command line options and improves the readability
of the man pages.

52 files changed:
INSTALL
Makefile.in
NEWS
README.afs
REQUIREMENTS
afh.c
audioc.c
audiod.c
bash_completion
client.c
client_common.c
command.c
daemon.c
daemon.h
filter.c
fsck.c
ggo/Makefile.ggo [deleted file]
ggo/afh.ggo [deleted file]
ggo/afh.m4 [new file with mode: 0644]
ggo/audioc.ggo [deleted file]
ggo/audioc.m4 [new file with mode: 0644]
ggo/audiod.ggo [deleted file]
ggo/audiod.m4 [new file with mode: 0644]
ggo/client.ggo [deleted file]
ggo/client.m4 [new file with mode: 0644]
ggo/color.m4 [new file with mode: 0644]
ggo/config_file.m4 [new file with mode: 0644]
ggo/daemon.m4 [new file with mode: 0644]
ggo/filter.ggo [deleted file]
ggo/filter.m4 [new file with mode: 0644]
ggo/fsck.ggo [deleted file]
ggo/fsck.m4 [new file with mode: 0644]
ggo/group.m4 [new file with mode: 0644]
ggo/gui.ggo [deleted file]
ggo/gui.m4 [new file with mode: 0644]
ggo/header.m4 [new file with mode: 0644]
ggo/logfile.m4 [new file with mode: 0644]
ggo/loglevel.m4 [new file with mode: 0644]
ggo/makefile [new file with mode: 0644]
ggo/recv.ggo [deleted file]
ggo/recv.m4 [new file with mode: 0644]
ggo/server.ggo [deleted file]
ggo/server.m4 [new file with mode: 0644]
ggo/user.m4 [new file with mode: 0644]
ggo/write.ggo [deleted file]
ggo/write.m4 [new file with mode: 0644]
gui.c
recv.c
server.c
string.c
string.h
write.c

diff --git a/INSTALL b/INSTALL
index 4d89153f1f91660d4ffb35dda2891904bedbee9b..b0bbbadbfdde6ade5b2555365dc87f90ca52d5a1 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -99,10 +99,10 @@ the directory /var/paraslash.
 Alternatively, use the --afs_socket Option to specify a different
 location for the afs command socket.
 
-For this first try, we'll use a debug level of two to make the
-output of para_server more verbose.
+For this first try, we'll use the info loglevel to make the output
+of para_server more verbose.
 
-       para_server -l 2
+       para_server -l info
 
 Now you can use para_client to connect to the server and issue
 commands. Open a new shell (as "bar" on "client_host" in the above
@@ -164,7 +164,7 @@ Paraslash comes with its own receiving and playing software, which
 will be described next. Try the following on client_host (assuming
 Linux/ALSA and an mp3 stream):
 
-       para_recv -l 2 -r 'http -i server_host' > file.mp3
+       para_recv -l info -r 'http -i server_host' > file.mp3
        # (interrupt with CTRL+C after a few seconds)
        ls -l file.mp3 # should not be empty
        para_filter -f mp3dec -f wav < file.mp3 > file.wav
@@ -196,7 +196,7 @@ supposed to play the audio stream. Try
 for help. Usually you have to specify only server_host as the receiver
 specifier for each supported audio format, like this:
 
-       para_audiod -l 2 -r 'mp3:http -i server_host'
+       para_audiod -l info -r 'mp3:http -i server_host'
 
 The preferred way to use para_audiod is to run it once at system start
 as an unprivileged user. para_audiod needs to create a "well-known"
index fc0ffa487cdb0848f5ea924bf706e59d8907a35a..670be971b5f10a9d9510667ff2af7989648f18b3 100644 (file)
@@ -60,15 +60,21 @@ BINARIES = para_server para_client para_audioc para_recv \
 man_binaries := $(BINARIES)
 man_pages := $(patsubst %, man/man1/%.1, $(man_binaries))
 man_pages_in := $(patsubst %, web/%.man.in.html, $(man_binaries))
+
 ggo_dir := ggo
-gengetopts := $(wildcard $(ggo_dir)/*.ggo)
-gengetopts_c := $(patsubst %/,, $(gengetopts:.ggo=.cmdline.c))
-gengetopts_h := $(patsubst %/,, $(gengetopts:.ggo=.cmdline.h))
+
+m4_ggos := afh audioc audiod client filter fsck gui recv server write
+all_ggos := $(m4_ggos) dccp_recv oggdec_filter alsa_write fade http_recv \
+       osx_write udp_recv amp_filter compress_filter file_write \
+       grab_client mp3dec_filter
+ggo_generated := $(addsuffix .cmdline.c, $(all_ggos)) $(addsuffix .cmdline.h, $(all_ggos)) \
+       $(addsuffix .ggo, $(addprefix $(ggo_dir)/,$(m4_ggos)))
+
 autocrap := config.h.in configure
 tarball_pfx := @PACKAGE_TARNAME@-$(PACKAGE_VERSION)
 tarball_delete = web versions pics .changelog_before_cvs .changelog_cvs .gitignore
 tarball_delete := $(patsubst %,$(tarball_pfx)/%,$(tarball_delete))
-tarball_add := $(gengetopts_c) $(gengetopts_h) $(autocrap)
+tarball_add := $(ggo_generated) $(autocrap)
 tarball := @PACKAGE_TARNAME@-$(PACKAGE_VERSION).tar.bz2
 
 .PHONY: clean distclean maintainer-clean install man tarball
@@ -79,7 +85,7 @@ tarball: $(tarball)
 *.o: para.h config.h gcc-compat.h
 
 include Makefile.deps
-include $(ggo_dir)/Makefile.ggo
+include $(ggo_dir)/makefile
 
 %_command_list.c %_command_list.h: %.cmd
        ./command_util.sh c < $< >$@
@@ -98,21 +104,9 @@ man/man1/para_audiod.1: para_audiod audiod_command_list.man
        mkdir -p man/man1
        help2man -h --detailed-help -N -i audiod_command_list.man ./para_audiod > $@
 
-man/man1/para_filter.1: para_filter
-       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/para_recv.1: para_recv
-       mkdir -p man/man1
-       help2man -h --detailed-help -N ./$< > $@
-
 man/man1/%.1: %
        mkdir -p man/man1
-       help2man -N ./$< > $@
+       help2man -h --detailed-help -N ./$< > $@
 
 man/html/%.html: man/man1/%.1
        mkdir -p man/html
@@ -187,7 +181,7 @@ distclean: clean
        rm -f GPATH GRTAGS GSYMS GTAGS
 
 maintainer-clean: distclean
-       rm -f $(gengetopts_c) $(gengetopts_h) *.tar.bz2 \
+       rm -f $(ggo_generated) *.tar.bz2 \
                config.h configure \
                config.h.in skencil/*.pdf skencil/*.ps
        rm -f *_command_list.* *.man man/man1/*
diff --git a/NEWS b/NEWS
index fdc4c071929923b2caeb91bdd01b8c68707b8c30..5464bd7a92c2d153902afc6ab0c838edfe24c3d8 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,7 +5,7 @@ NEWS
 0.3.4 (to be announced) "elliptic inheritance"
 ----------------------------------------------
 
-The new udp sender and various other improvements.
+The new udp sender, colored logs and various other improvements.
 
        - The udp sender replaces the ortp sender. The new code is
          both smaller and cleaner than the old ortp sender/receiver
@@ -13,9 +13,12 @@ The new udp sender and various other improvements.
          libraries, it is built unconditionally. The default port
          for udp streaming now defaults to 8000, like for the http
          and the dccp senders/receivers.
+       - Loglevels are now specified as symbolic names, e.g.
+         "--loglevel info".
        - para_server/para_audiod: Color support for log messages.
        - new options for mp3dec: --ignore-crc, --bufsize
        - new audiod option: --config-file.
+       - gengetopt cleanups.
        - Improved help/man pages: The documentation of para_audiod,
          para_recv, para_filter and para_write now also contains
          all options of the available receivers/filters/writers. The
index 01d4b52e7bf6adacb45ba5a395cb5115f376b92c..ca01df6ac678a7cb3b1be14ac5957a1ddb1a4137 100644 (file)
@@ -225,7 +225,7 @@ songs is
 Troubles?
 ---------
 
-Use the debug loglevel (option -l 0 for most commands) to show
+Use the debug loglevel (option -l debug for most commands) to show
 debugging info. Almost all paraslash executables have a brief online
 help which is displayed by using the -h switch. The --detailed-help
 option prints the full help text.
index 889ad5f9e5ff2eee152bfd93d0d2de3d4fe92316..c1743fd2fb55f810f95949d7586ff7c3376b2801 100644 (file)
@@ -53,3 +53,4 @@ Hacking the source:
        - grutatxt http://www.triptico.com/software/grutatxt.html
        - doxygen http://www.stack.nl/~dimitri/doxygen/
        - global ftp://ftp.gnu.org/pub/gnu/global
+       - m4: ftp://ftp.gnu.org/pub/gnu/m4/
diff --git a/afh.c b/afh.c
index 2d92d04d0e7b3ad3907410c556c0c447576bd4d6..fad93c49cdca17f54558c2c6cdc25646773bea11 100644 (file)
--- a/afh.c
+++ b/afh.c
@@ -21,7 +21,9 @@ static struct afh_args_info conf;
 const char *status_item_list[] = {STATUS_ITEM_ARRAY};
 
 INIT_AFH_ERRLISTS;
-INIT_STDERR_LOGGING(conf.loglevel_arg)
+
+static int loglevel;
+INIT_STDERR_LOGGING(loglevel)
 
 static void print_info(int audio_format_num, struct afh_info *afhi)
 {
@@ -139,6 +141,7 @@ int main(int argc, char **argv)
 
        afh_cmdline_parser(argc, argv, &conf);
        HANDLE_VERSION_FLAG("afh", conf);
+       loglevel = get_loglevel_by_name(conf.loglevel_arg);
        ret = -E_AFH_SYNTAX;
        if (conf.inputs_num == 0)
                goto out;
index 0c2049ad71cb06a77297d502d7acae7b3265e79e..666990dba411e65b4dfff4d4d227332e7401ac92 100644 (file)
--- a/audioc.c
+++ b/audioc.c
@@ -21,7 +21,8 @@ INIT_AUDIOC_ERRLISTS;
 /** the gengetopt structure containing command line args */
 struct audioc_args_info conf;
 
-INIT_STDERR_LOGGING(conf.loglevel_arg);
+static int loglevel;
+INIT_STDERR_LOGGING(loglevel);
 
 static char *concat_args(unsigned argc, char * const *argv)
 {
@@ -87,6 +88,7 @@ int main(int argc, char *argv[])
                        exit(EXIT_FAILURE);
                }
        }
+       loglevel = get_loglevel_by_name(conf.loglevel_arg);
        args = conf.inputs_num?
                concat_args(conf.inputs_num, conf.inputs) :
                para_strdup("stat");
index b781527ccabb40c43f50a80aab87ef42ee06fb0e..a92c4e3b1ebca665a3804bc168472673fd733037 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -1143,7 +1143,7 @@ int main(int argc, char *argv[])
                PARA_EMERG_LOG("init stream io error: %s\n", para_strerror(-i));
                exit(EXIT_FAILURE);
        }
-       log_welcome("para_audiod", conf.loglevel_arg);
+       log_welcome("para_audiod");
        server_uptime(UPTIME_SET);
        set_initial_status();
        FOR_EACH_SLOT(i)
index aeee64c17713f7d1d16cb1b226958fcf7d304124..cd647e2096b61ce583a4bd48318484cb814762e9 100644 (file)
@@ -2,7 +2,7 @@
 #
 # Licensed under the GPL v2. For licencing details see COPYING.
 
-PC="para_client -l 5 -- "
+PC="para_client -l error -- "
 
 __para_commandlist=
 __para_sender_list=
index 10cb80505f6b5163a375c7804da4bb136c6ce8a2..fdd07b247e617c86d3f38ff059d8bb8672356a9c 100644 (file)
--- a/client.c
+++ b/client.c
@@ -54,7 +54,8 @@ static struct task svt = {
        .status = "supervisor task"
 };
 
-INIT_STDERR_LOGGING(ct->conf.loglevel_arg);
+static int client_loglevel; /* loglevel */
+INIT_STDERR_LOGGING(client_loglevel);
 
 
 /**
@@ -82,6 +83,7 @@ int main(int argc, char *argv[])
        ret = client_open(argc, argv, &ct);
        if (ret < 0) /* can not use PARA_LOG here because ct is NULL */
                exit(EXIT_FAILURE);
+       client_loglevel = get_loglevel_by_name(ct->conf.loglevel_arg);
        register_task(&svt);
        ret = schedule(&s);
        if (ret < 0)
index e5be430dfdb43021bfc9a01443593423cc5802b6..e757a3a7a954bb6885a61613ce19c7158f96330f 100644 (file)
@@ -364,7 +364,7 @@ int client_open(int argc, char *argv[], struct client_task **ct_ptr)
                        goto out;
        }
        ret = 1;
-       PARA_INFO_LOG("loglevel: %d\n", ct->conf.loglevel_arg);
+       PARA_INFO_LOG("loglevel: %s\n", ct->conf.loglevel_arg);
        PARA_INFO_LOG("config_file: %s\n", ct->config_file);
        PARA_INFO_LOG("key_file: %s\n", ct->key_file);
        PARA_NOTICE_LOG("connecting %s:%d\n", ct->conf.hostname_arg,
index 19a9aa7e9a5674fc092f0a54e7026af8ce33df3b..9abe04a341f94520a3720167e6610f1940e9fb24 100644 (file)
--- a/command.c
+++ b/command.c
@@ -283,7 +283,7 @@ int com_si(int fd, int argc, __a_unused char * const * argv)
                "server_pid: %d\n"
                "afs_pid: %d\n"
                "connections (active/accepted/total): %u/%u/%u\n"
-               "current loglevel: %i\n"
+               "current loglevel: %s\n"
                "supported audio formats: %s\n"
                "supported senders: %s\n"
                "%s",
index 2f706b01bde62c8821dc76e66ad387a905782d91..cae63ea7f48488124085d79360458ee44b5620a8 100644 (file)
--- a/daemon.c
+++ b/daemon.c
@@ -58,25 +58,6 @@ void daemon_set_default_log_colors(void)
        }
 }
 
-static int get_loglevel_by_name(const char *txt, size_t n)
-{
-       if (!strncasecmp(txt, "debug", n))
-               return LL_DEBUG;
-       if (!strncasecmp(txt, "info", n))
-               return LL_INFO;
-       if (!strncasecmp(txt, "notice", n))
-               return LL_NOTICE;
-       if (!strncasecmp(txt, "warning", n))
-               return LL_WARNING;
-       if (!strncasecmp(txt, "error", n))
-               return LL_ERROR;
-       if (!strncasecmp(txt, "crit", n))
-               return LL_CRIT;
-       if (!strncasecmp(txt, "emerg", n))
-               return LL_EMERG;
-       return -1;
-}
-
 /**
  * Set the color for one loglevel.
  *
@@ -93,7 +74,7 @@ int daemon_set_log_color(char const *arg)
 
        if (!p)
                goto err;
-       ret = get_loglevel_by_name(arg, p - arg);
+       ret = get_loglevel_by_name(arg);
        if (ret < 0)
                goto err;
        ll = ret;
@@ -126,9 +107,12 @@ void daemon_set_logfile(char *logfile_name)
  *
  * \param loglevel The smallest level that should be logged.
  */
-void daemon_set_loglevel(int loglevel)
+void daemon_set_loglevel(char *loglevel)
 {
-       me->loglevel = loglevel;
+       int ret = get_loglevel_by_name(loglevel);
+
+       assert(ret >= 0);
+       me->loglevel = ret;
 }
 
 /**
@@ -234,11 +218,10 @@ void daemon_open_log_or_die(void)
 /**
  * Log the startup message containing the paraslash version.
  */
-void log_welcome(const char *whoami, int loglevel)
+void log_welcome(const char *whoami)
 {
        PARA_INFO_LOG("welcome to %s " PACKAGE_VERSION " ("BUILD_DATE")\n",
                whoami);
-       PARA_DEBUG_LOG("using loglevel %d\n", loglevel);
 }
 
 /**
index c0a9f20c9b902fa1eb41e129663978e52a2655e7..c8dd997f97706321f98b3b6808d5e3f29e24fcf9 100644 (file)
--- a/daemon.h
+++ b/daemon.h
@@ -4,7 +4,7 @@
 void daemonize(void);
 void daemon_open_log_or_die(void);
 void daemon_close_log(void);
-void log_welcome(const char *whoami, int loglevel);
+void log_welcome(const char *whoami);
 void drop_privileges_or_die(const char *username, const char *groupname);
 /** used for server_uptime() */
 enum uptime {UPTIME_SET, UPTIME_GET};
@@ -13,7 +13,7 @@ __malloc char *uptime_str(void);
 void daemon_set_logfile(char *logfile_name);
 void daemon_set_flag(unsigned flag);
 void daemon_clear_flag(unsigned flag);
-void daemon_set_loglevel(int loglevel);
+void daemon_set_loglevel(char *loglevel);
 void daemon_set_default_log_colors(void);
 int daemon_set_log_color(char const *arg);
 
index 50b17ad7f41293fd63068303bba5c1bef5e33605..96880b7d31922221b9eb90e25a52a258a60d3245 100644 (file)
--- a/filter.c
+++ b/filter.c
@@ -44,7 +44,8 @@ static struct stdout_task *sot = &stdout_task_struct;
 /** Gengetopt struct that holds the command line args. */
 static struct filter_args_info conf;
 
-INIT_STDERR_LOGGING(conf.loglevel_arg);
+static int loglevel;
+INIT_STDERR_LOGGING(loglevel);
 
 static void open_filters(void)
 {
@@ -162,6 +163,7 @@ int main(int argc, char *argv[])
        ret = parse_config(argc, argv);
        if (ret < 0)
                goto out;
+       loglevel = get_loglevel_by_name(conf.loglevel_arg);
        ret = init_filter_chain();
        if (ret < 0)
                goto out;
diff --git a/fsck.c b/fsck.c
index 04db5de34b11d524dc29a7ae7610225b853308e7..3b605c2d0a65d6260094ba99494009ee8bbfbef8 100644 (file)
--- a/fsck.c
+++ b/fsck.c
@@ -19,7 +19,9 @@
 static struct fsck_args_info conf;
 
 INIT_FSCK_ERRLISTS;
-INIT_STDERR_LOGGING(conf.loglevel_arg);
+
+static int loglevel;
+INIT_STDERR_LOGGING(loglevel);
 
 /* taken from git */
 signed char hexval_table[256] = {
@@ -955,6 +957,7 @@ int main(int argc, char **argv)
                goto out;
        }
        HANDLE_VERSION_FLAG("fsck", conf);
+       loglevel = get_loglevel_by_name(conf.loglevel_arg);
        if (conf.base_dir_given)
                base_dir = para_strdup(conf.base_dir_arg);
        else {
@@ -978,9 +981,6 @@ out:
                        base_dir? base_dir : "",
                        para_strerror(-ret)
                );
-               if (conf.loglevel_arg > 1)
-                       PARA_EMERG_LOG("re-run with \"--loglevel %d\" to increase verbosity\n",
-                               conf.loglevel_arg - 1);
        } else
                PARA_NOTICE_LOG("success\n");
        if (base_dir)
diff --git a/ggo/Makefile.ggo b/ggo/Makefile.ggo
deleted file mode 100644 (file)
index e1b232e..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-module_ggo_opts := --set-version="($(PACKAGE_STRING), $(codename))"
-
-grab_client.cmdline.h grab_client.cmdline.c: $(ggo_dir)/grab_client.ggo
-       gengetopt $(module_ggo_opts) \
-               -S \
-               --set-package=grab \
-               --no-handle-help \
-               --no-handle-error \
-               --no-handle-version \
-               --arg-struct-name=grab_client_args_info \
-               --file-name=$(subst .ggo,,$(<F)).cmdline \
-               --func-name $(subst .ggo,,$(<F))_cmdline_parser < $<
-
-%_recv.cmdline.h %_recv.cmdline.c: $(ggo_dir)/%_recv.ggo
-       gengetopt $(module_ggo_opts) \
-               --set-package=$(subst .ggo,,$(<F)) \
-               --arg-struct-name=$(subst .ggo,,$(<F))_args_info \
-               --file-name=$(subst .ggo,,$(<F)).cmdline \
-               --func-name $(subst .ggo,,$(<F))_cmdline_parser < $<
-
-%_filter.cmdline.h %_filter.cmdline.c: $(ggo_dir)/%_filter.ggo
-       gengetopt $(module_ggo_opts) \
-               --set-package=$(subst .ggo,,$(<F)) \
-               --arg-struct-name=$(subst .ggo,,$(<F))_args_info \
-               --file-name=$(subst .ggo,,$(<F)).cmdline \
-               --func-name $(subst _filter.ggo,,$(<F))_cmdline_parser < $<
-%_write.cmdline.h %_write.cmdline.c: $(ggo_dir)/%_write.ggo
-       gengetopt -S $(module_ggo_opts) \
-               --set-package=$(subst .ggo,,$(<F)) \
-               --arg-struct-name=$(subst .ggo,,$(<F))_args_info \
-               --file-name=$(subst .ggo,,$(<F)).cmdline \
-               --func-name $(subst _write.ggo,,$(<F))_cmdline_parser < $<
-
-%.cmdline.h %.cmdline.c: $(ggo_dir)/%.ggo
-       case $(<F) in client.ggo) O="--unamed-opts=command";; \
-               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";; \
-               audiod.ggo) O="--no-handle-help";; \
-       esac; \
-       if test $(<F) != fsck.ggo; then O="$$O --conf-parser "; fi; \
-       gengetopt $$O \
-               --no-handle-version \
-               --file-name=$(*F).cmdline \
-               --func-name $(*F)_cmdline_parser \
-               --arg-struct-name=$(*F)_args_info \
-               --set-package="para_$(subst .cmdline,,$(*F))" \
-               --set-version="$(PACKAGE_VERSION)"  < $<
-
diff --git a/ggo/afh.ggo b/ggo/afh.ggo
deleted file mode 100644 (file)
index 056a34d..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-text "
-para_afh, the audio format handler tool, is a stand-alone program
-contained in the paraslash package for analyzing and streaming audio
-files. It can be used to
-
-       - print tech info about the given audio file to stdout.
-       In particular, the 'chunk table' of the audio file, an array
-       of offsets within the audio file, may be printed. This table
-       can be used by other programs unaware of the particular audio
-       format to stream the audio file.
-
-       - write selected parts of the given audio file in complete
-       chunks without decoding. Thus para_afh can be used to 'cut'
-       an audio file.
-
-       - write selected parts of the given audio files 'just in time'
-       to sdout.  This may be useful for third-party software that
-       is capable of reading from stdin.
-"
-
-option "loglevel" l
-#~~~~~~~~~~~~~~~~~~
-"set loglevel (0-6)"
-int typestr="level"
-default="4"
-optional
-
-defgroup "mode"
-#--------------
-groupdesc="
-       There are two modes of operation: Info mode and stream mode,
-       one of which must be selected by the corresponding option.
-       See below.
-"
-required
-
-groupoption "info" i
-#~~~~~~~~~~~~~~~~~~~
-"select info mode"
-group="mode"
-details="
-       In this mode, the program prints technical information about
-       the given audio file to stdout.
-"
-
-groupoption "stream" s
-#~~~~~~~~~~~~~~~~~~~~~
-"select stream mode"
-group="mode"
-details="
-       If this mode is selected, the selected parts of the content
-       of the audio file are written to stdout. Only complete chunks
-       with respect of the underlying audio format are written.
-       For example, only complete frames in case of mp3 files.
-"
-
-section "Options for info mode"
-#==============================
-
-option "chunk_table" c
-#~~~~~~~~~~~~~~~~~~~~~
-"print also the chunk table"
-flag off
-dependon="info"
-
-section "Options for stream mode"
-#================================
-
-
-option "begin_chunk" b
-#~~~~~~~~~~~~~~~~~~~~~
-"skip a number of chunks"
-int typestr="chunk_num"
-default="0"
-dependon="stream"
-optional
-details="
-       The chunk_num argument must be between -num_chunks and
-       num_chunks - 1 inclusively where num_chunks is the total number
-       of chunks which is printed when using the --info option. If
-       chunk_num is negative, the given number of chunks are counted
-       backwards from the end of the file. For example --begin_chunk
-       -100 instructs para_afh to start output at chunk num_chunks
-       - 100. This is mainly useful for cutting off the end of an
-       audio file.
-"
-
-option "end_chunk" e
-#~~~~~~~~~~~~~~~~~~~
-"only write up to chunk chunk_num"
-int typestr="chunk_num"
-dependon="stream"
-optional
-details="
-       For the chunk_num argument the same rules as for --begin_chunk
-       apply.  The default is to write up to the last chunk.
-"
-
-option "just_in_time" j
-#~~~~~~~~~~~~~~~~~~~~~~
-"use timed writes"
-flag off
-dependon="stream"
-details="
-       Write the specified chunks of data 'just in time', i.e. the
-       write of each chunk is delayed until the time it is needed
-       by the decoder/player in order to guarantee an uninterupted
-       audio stream.
-"
-
-option "no_header" H
-#~~~~~~~~~~~~~~~~~~~
-"do not write an audio file header"
-flag off
-dependon="stream"
-details="
-       If an audio format needs information about the audio file
-       in a format-specific header in order to be understood by
-       the decoding software, a suitable header is automatically
-       send. This option changes the default behaviour, i.e. no
-       header is written.
-"
diff --git a/ggo/afh.m4 b/ggo/afh.m4
new file mode 100644 (file)
index 0000000..97b8f28
--- /dev/null
@@ -0,0 +1,122 @@
+include(header.m4)
+<qu>
+text "
+para_afh, the audio format handler tool, is a stand-alone program
+contained in the paraslash package for analyzing and streaming audio
+files. It can be used to
+
+       - print tech info about the given audio file to stdout.
+       In particular, the 'chunk table' of the audio file, an array
+       of offsets within the audio file, may be printed. This table
+       can be used by other programs unaware of the particular audio
+       format to stream the audio file.
+
+       - write selected parts of the given audio file in complete
+       chunks without decoding. Thus para_afh can be used to 'cut'
+       an audio file.
+
+       - write selected parts of the given audio files 'just in time'
+       to sdout.  This may be useful for third-party software that
+       is capable of reading from stdin.
+"
+</qu>
+
+include(loglevel.m4)
+
+<qu>
+defgroup "mode"
+#--------------
+groupdesc="
+       There are two modes of operation: Info mode and stream mode,
+       one of which must be selected by the corresponding option.
+       See below.
+"
+required
+
+groupoption "info" i
+#~~~~~~~~~~~~~~~~~~~
+"select info mode"
+group="mode"
+details="
+       In this mode, the program prints technical information about
+       the given audio file to stdout.
+"
+
+groupoption "stream" s
+#~~~~~~~~~~~~~~~~~~~~~
+"select stream mode"
+group="mode"
+details="
+       If this mode is selected, the selected parts of the content
+       of the audio file are written to stdout. Only complete chunks
+       with respect of the underlying audio format are written.
+       For example, only complete frames in case of mp3 files.
+"
+
+section "Options for info mode"
+#==============================
+
+option "chunk_table" c
+#~~~~~~~~~~~~~~~~~~~~~
+"print also the chunk table"
+flag off
+dependon="info"
+
+section "Options for stream mode"
+#================================
+
+
+option "begin_chunk" b
+#~~~~~~~~~~~~~~~~~~~~~
+"skip a number of chunks"
+int typestr="chunk_num"
+default="0"
+dependon="stream"
+optional
+details="
+       The chunk_num argument must be between -num_chunks and
+       num_chunks - 1 inclusively where num_chunks is the total number
+       of chunks which is printed when using the --info option. If
+       chunk_num is negative, the given number of chunks are counted
+       backwards from the end of the file. For example --begin_chunk
+       -100 instructs para_afh to start output at chunk num_chunks
+       - 100. This is mainly useful for cutting off the end of an
+       audio file.
+"
+
+option "end_chunk" e
+#~~~~~~~~~~~~~~~~~~~
+"only write up to chunk chunk_num"
+int typestr="chunk_num"
+dependon="stream"
+optional
+details="
+       For the chunk_num argument the same rules as for --begin_chunk
+       apply.  The default is to write up to the last chunk.
+"
+
+option "just_in_time" j
+#~~~~~~~~~~~~~~~~~~~~~~
+"use timed writes"
+flag off
+dependon="stream"
+details="
+       Write the specified chunks of data 'just in time', i.e. the
+       write of each chunk is delayed until the time it is needed
+       by the decoder/player in order to guarantee an uninterupted
+       audio stream.
+"
+
+option "no_header" H
+#~~~~~~~~~~~~~~~~~~~
+"do not write an audio file header"
+flag off
+dependon="stream"
+details="
+       If an audio format needs information about the audio file
+       in a format-specific header in order to be understood by
+       the decoding software, a suitable header is automatically
+       send. This option changes the default behaviour, i.e. no
+       header is written.
+"
+</qu>
diff --git a/ggo/audioc.ggo b/ggo/audioc.ggo
deleted file mode 100644 (file)
index 87ef71e..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-option "loglevel" l
-#~~~~~~~~~~~~~~~~~~
-"set loglevel (0-6)"
-       int typestr="level"
-       default="4"
-       optional
-
-
-option "socket" s
-#~~~~~~~~~~~~~~~~
-"well-known socket (default=/var/paraslash/audiod.socket.$HOSTNAME)"
-       string typestr="filename"
-       optional
-
-
-option "bufsize" b
-#~~~~~~~~~~~~~~~~~
-"size of internal buffer"
-       int typestr="bytes"
-       default="8192"
-       optional
diff --git a/ggo/audioc.m4 b/ggo/audioc.m4
new file mode 100644 (file)
index 0000000..ad112e2
--- /dev/null
@@ -0,0 +1,15 @@
+include(header.m4)
+include(loglevel.m4)
+option "socket" s
+#~~~~~~~~~~~~~~~~
+"well-known socket (default=/var/paraslash/audiod.socket.$HOSTNAME)"
+       string typestr="filename"
+       optional
+
+
+option "bufsize" b
+#~~~~~~~~~~~~~~~~~
+"size of internal buffer"
+       int typestr="bytes"
+       default="8192"
+       optional
diff --git a/ggo/audiod.ggo b/ggo/audiod.ggo
deleted file mode 100644 (file)
index 6048b87..0000000
+++ /dev/null
@@ -1,239 +0,0 @@
-#########################
-section "General options"
-#########################
-
-text "
-       These options are identical to their counterparts in para_server
-       and are discussed in detail there.
-"
-
-option "loglevel" l
-#~~~~~~~~~~~~~~~~~~
-"set loglevel (0-6)"
-int typestr="level"
-default="3"
-optional
-
-option "color" C
-#~~~~~~~~~~~~~~~
-"activate color output"
-enum typestr="when"
-values = "yes","no","auto"
-default = "auto"
-optional
-
-option "log_color" -
-#~~~~~~~~~~~~~~~~~~~
-"select a color for one type of log message"
-string typestr="color_spec"
-multiple
-optional
-details="
-       Example: --log_color \"INFO:yellow black bold\"
-"
-
-option "config_file" c
-#~~~~~~~~~~~~~~~~~~~~~
-"(default='~/.paraslash/audiod.conf'"
-string typestr="filename"
-optional
-
-option "logfile" L
-#~~~~~~~~~~~~~~~~~
-"where to write log output"
-string typestr="filename"
-optional
-
-option "daemon" d
-#~~~~~~~~~~~~~~~~
-"run as background daemon"
-flag off
-dependon="logfile"
-
-option "user" u
-#~~~~~~~~~~~~~~
-"run as the given user"
-string typestr="name"
-optional
-
-option "group" g
-#~~~~~~~~~~~~~~~
-"set group id"
-string typestr="group"
-optional
-
-########################
-section "Audiod options"
-########################
-
-option "force" F
-#~~~~~~~~~~~~~~~
-"force startup"
-flag off
-details="
-       If this flag is not given, para_audiod refuses to start if the
-       well-known socket file (see the --socket option) already exists
-       because this usually means that para_audiod is already running
-       and listening on that socket. After a crash or if para_audiod
-       received a SIGKILL signal, a stale socket file might remain and
-       you have to use --force once to force startup of para_audiod.
-"
-
-option "mode" m
-#~~~~~~~~~~~~~~
-"startup mode"
-string typestr="mode"
-default="on"
-optional
-details="
-       Para_audiod supports three modes of operation: On, off and
-       standby (sb).  This option selects the mode that should be
-       used on startup. If para_audiod operates in \"on\" mode, it
-       will connect to para_server in order to receive its status
-       information. If para_server announces the availability of an
-       audio stream, para_audiod will automatically download, decode
-       and play the audio stream according to the given stream I/O
-       options, see below.
-
-       In \"standby\" mode, para_audiod will only receive the
-       status information from para_server but will not download
-       the audio stream.
-
-       In \"off\" mode, para_audiod does not connect para_server at
-       all, but still listens on the local socket for connections.
-"
-
-option "socket" s
-#~~~~~~~~~~~~~~~~
-"well-known socket"
-string typestr="filename"
-optional
-details="
-       Para_audiod uses a \"well-known\" socket to listen
-       on for connections from para_audioc. This socket is a
-       special file in the file system; its location defaults to
-       /var/paraslash/audiod_sock.<host_name>.
-
-       para_audioc, the client program used to connect to para_audiod,
-       opens this socket in order to talk to para_audiod.  If the
-       default value for para_audiod is changed, para_audioc must be
-       instructed to use also \"filename\" for connecting para_audiod.
-"
-
-option "user_allow" -
-#~~~~~~~~~~~~~~~~~~~~
-"allow this uid"
-int typestr="uid"
-default="-1"
-optional
-multiple
-details="
-       Allow the user identified by \"uid\" to connect to para_audiod.
-       May be specified multiple times. If not specified at all,
-       all users are allowed to connect.
-
-       This feature requires unix socket credentials and is currently
-       only supported on Linux systems. On other operating systems,
-       the option is silently ignored and all local users are allowed
-       to connect to para_audiod.
-"
-
-option "clock_diff_count" -
-#~~~~~~~~~~~~~~~~~~~~~~~~~~
-"sync clock on startup"
-int typestr="count"
-default="0"
-optional
-details="
-       Check the clock difference between the host running para_server
-       and the local host running para_audiod that many times before
-       starting any stream I/0. Set this to non-zero for non-local
-       setups if the clocks of these two hosts are not syncronized
-       by ntp or similar.
-"
-
-#############################
-section "Stream I/O options"
-#############################
-
-option "receiver" r
-#~~~~~~~~~~~~~~~~~~
-"select receiver"
-string typestr="receiver_spec"
-default="http"
-optional
-multiple
-details="
-       This option may be given multiple times, once for each
-       supported audio format. The \"receiver_spec\" consists of
-       an audio format and the receiver name, separated by a colon,
-       and any options for that receiver, seperated by whitespace.
-       If any receiver options are present, the whole receiver
-       argument must be quoted.
-
-       Example:
-
-               -r 'mp3:http -i my.host.org -p 8009'
-"
-
-
-option "no_default_filters" D
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-"Configure filters manually"
-flag off
-details="
-       If (and only if) this option is set, the --filter options
-       (see below) take effect.  Otherwise, the compiled-in default
-       filters mp3dec, oggdec and aacdec are activated for mp3, ogg,
-       aac streams respectively.
-"
-
-option "filter" f
-#~~~~~~~~~~~~~~~~
-"Use non-default filters"
-string typestr="filter_spec"
-optional
-multiple
-dependon="no_default_filters"
-details="
-       This option may be given multiple times. The \"filter_spec\"
-       consists of an audio format, the name of the filter, and any
-       options for that filter. Mote that order matters.
-
-       Examples:
-
-               --filter 'mp3:mp3dec'
-
-               --filter 'mp3:compress --inertia 5 --damp 2'
-
-"
-
-option "writer" w
-#~~~~~~~~~~~~~~~~
-"Specify stream writer."
-string typestr="writer_spec"
-optional
-multiple
-details="
-       May be given multiple times, even multiple times for the same
-       audio format.  Default value is \"alsa\" for all supported
-       audio formats. Example:
-
-               --writer 'aac:osx'
-
-"
-
-option "stream_delay" -
-#~~~~~~~~~~~~~~~~~~~~~~
-"time for client sync"
-int typestr="milliseconds"
-default="200"
-optional
-details="
-       Add the given amount of milliseconds to the stream start time
-       announced by para_server and do not send data to the writer
-       before that time (modulo clock difference).
-
-       This is useful mainly for syncronizing the audio output of
-       different clients.
-"
diff --git a/ggo/audiod.m4 b/ggo/audiod.m4
new file mode 100644 (file)
index 0000000..5390d1b
--- /dev/null
@@ -0,0 +1,195 @@
+include(header.m4)
+define(CURRENT_PROGRAM,para_audiod)
+define(DEFAULT_CONFIG_FILE,~/.paraslash/audiod.conf)
+
+<qu>
+#########################
+section "General options"
+#########################
+</qu>
+
+include(loglevel.m4)
+include(color.m4)
+include(config_file.m4)
+include(logfile.m4)
+include(daemon.m4)
+include(user.m4)
+include(group.m4)
+
+<qu>
+########################
+section "Audiod options"
+########################
+
+option "force" F
+#~~~~~~~~~~~~~~~
+"force startup"
+flag off
+details="
+       If this flag is not given, para_audiod refuses to start if the
+       well-known socket file (see the --socket option) already exists
+       because this usually means that para_audiod is already running
+       and listening on that socket. After a crash or if para_audiod
+       received a SIGKILL signal, a stale socket file might remain and
+       you have to use --force once to force startup of para_audiod.
+"
+
+option "mode" m
+#~~~~~~~~~~~~~~
+"startup mode"
+string typestr="mode"
+default="on"
+optional
+details="
+       Para_audiod supports three modes of operation: On, off and
+       standby (sb).  This option selects the mode that should be
+       used on startup. If para_audiod operates in \"on\" mode, it
+       will connect to para_server in order to receive its status
+       information. If para_server announces the availability of an
+       audio stream, para_audiod will automatically download, decode
+       and play the audio stream according to the given stream I/O
+       options, see below.
+
+       In \"standby\" mode, para_audiod will only receive the
+       status information from para_server but will not download
+       the audio stream.
+
+       In \"off\" mode, para_audiod does not connect para_server at
+       all, but still listens on the local socket for connections.
+"
+
+option "socket" s
+#~~~~~~~~~~~~~~~~
+"well-known socket"
+string typestr="filename"
+optional
+details="
+       Para_audiod uses a \"well-known\" socket to listen
+       on for connections from para_audioc. This socket is a
+       special file in the file system; its location defaults to
+       /var/paraslash/audiod_sock.<host_name>.
+
+       para_audioc, the client program used to connect to para_audiod,
+       opens this socket in order to talk to para_audiod.  If the
+       default value for para_audiod is changed, para_audioc must be
+       instructed to use also \"filename\" for connecting para_audiod.
+"
+
+option "user_allow" -
+#~~~~~~~~~~~~~~~~~~~~
+"allow this uid"
+int typestr="uid"
+default="-1"
+optional
+multiple
+details="
+       Allow the user identified by \"uid\" to connect to para_audiod.
+       May be specified multiple times. If not specified at all,
+       all users are allowed to connect.
+
+       This feature requires unix socket credentials and is currently
+       only supported on Linux systems. On other operating systems,
+       the option is silently ignored and all local users are allowed
+       to connect to para_audiod.
+"
+
+option "clock_diff_count" -
+#~~~~~~~~~~~~~~~~~~~~~~~~~~
+"sync clock on startup"
+int typestr="count"
+default="0"
+optional
+details="
+       Check the clock difference between the host running para_server
+       and the local host running para_audiod that many times before
+       starting any stream I/0. Set this to non-zero for non-local
+       setups if the clocks of these two hosts are not syncronized
+       by ntp or similar.
+"
+
+#############################
+section "Stream I/O options"
+#############################
+
+option "receiver" r
+#~~~~~~~~~~~~~~~~~~
+"select receiver"
+string typestr="receiver_spec"
+default="http"
+optional
+multiple
+details="
+       This option may be given multiple times, once for each
+       supported audio format. The \"receiver_spec\" consists of
+       an audio format and the receiver name, separated by a colon,
+       and any options for that receiver, seperated by whitespace.
+       If any receiver options are present, the whole receiver
+       argument must be quoted.
+
+       Example:
+
+               -r 'mp3:http -i my.host.org -p 8009'
+"
+
+
+option "no_default_filters" D
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+"Configure filters manually"
+flag off
+details="
+       If (and only if) this option is set, the --filter options
+       (see below) take effect.  Otherwise, the compiled-in default
+       filters mp3dec, oggdec and aacdec are activated for mp3, ogg,
+       aac streams respectively.
+"
+
+option "filter" f
+#~~~~~~~~~~~~~~~~
+"Use non-default filters"
+string typestr="filter_spec"
+optional
+multiple
+dependon="no_default_filters"
+details="
+       This option may be given multiple times. The \"filter_spec\"
+       consists of an audio format, the name of the filter, and any
+       options for that filter. Mote that order matters.
+
+       Examples:
+
+               --filter 'mp3:mp3dec'
+
+               --filter 'mp3:compress --inertia 5 --damp 2'
+
+"
+
+option "writer" w
+#~~~~~~~~~~~~~~~~
+"Specify stream writer."
+string typestr="writer_spec"
+optional
+multiple
+details="
+       May be given multiple times, even multiple times for the same
+       audio format.  Default value is \"alsa\" for all supported
+       audio formats. Example:
+
+               --writer 'aac:osx'
+
+"
+
+option "stream_delay" -
+#~~~~~~~~~~~~~~~~~~~~~~
+"time for client sync"
+int typestr="milliseconds"
+default="200"
+optional
+details="
+       Add the given amount of milliseconds to the stream start time
+       announced by para_server and do not send data to the writer
+       before that time (modulo clock difference).
+
+       This is useful mainly for syncronizing the audio output of
+       different clients.
+"
+</qu>
diff --git a/ggo/client.ggo b/ggo/client.ggo
deleted file mode 100644 (file)
index 1d6b410..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-# file client.conf
-args "--no-handle-error"
-option "hostname" i "ip or host to connect" string typestr="host" default="localhost" optional
-option "user" u "paraslash username" string typestr="username" default="<current user>" optional
-option "server_port" p "port to connect" int typestr="port" default="2990" optional
-option "key_file" k "(default='~/.paraslash/key.<user>')" string typestr="filename" optional
-option "loglevel" l "set loglevel (0-6)" int typestr="number" default="5" optional
-option "config_file" c "(default='~/.paraslash/client.conf')" string typestr="filename" optional
-option "plain" - "request an uncrypted session" flag off
diff --git a/ggo/client.m4 b/ggo/client.m4
new file mode 100644 (file)
index 0000000..1ae5a38
--- /dev/null
@@ -0,0 +1,17 @@
+include(header.m4)
+define(CURRENT_PROGRAM,para_client)
+define(DEFAULT_CONFIG_FILE,~/.paraslash/client.conf)
+<qu>
+args "--no-handle-error"
+option "hostname" i "ip or host to connect" string typestr="host" default="localhost" optional
+option "user" u "paraslash username" string typestr="username" default="<current user>" optional
+option "server_port" p "port to connect" int typestr="port" default="2990" optional
+option "key_file" k "(default='~/.paraslash/key.<user>')" string typestr="filename" optional
+</qu>
+
+include(loglevel.m4)
+include(config_file.m4)
+
+<qu>
+option "plain" - "request an uncrypted session" flag off
+</qu>
diff --git a/ggo/color.m4 b/ggo/color.m4
new file mode 100644 (file)
index 0000000..63e996f
--- /dev/null
@@ -0,0 +1,34 @@
+<qu>
+
+option "color" C
+#~~~~~~~~~~~~~~~
+"activate color output"
+enum typestr="when"
+values = "yes","no","auto"
+default = "auto"
+optional
+
+option "log_color" -
+#~~~~~~~~~~~~~~~~~~~
+"select a color for one type of log message"
+string typestr="color_spec"
+multiple
+optional
+details="
+       The format of \"color_spec\" is [fg [bg]] [attr].
+
+       Valid colors for \"fg\" and \"bg\" are \"normal\", \"black\",
+       \"red\", \"green\", \"yellow\", \"blue\", \"magenta\",
+       \"cyan\", and \"white\".
+
+       The \"attr\" value must be one of \"bold\", \"dim\", \"ul\",
+       \"blink\", \"reverse\".
+
+       Examples:
+
+               --log_color \"debug:green\"
+               --log_color \"info:yellow bold\"
+               --log_color \"notice:white red bold\"
+"
+
+</qu>
diff --git a/ggo/config_file.m4 b/ggo/config_file.m4
new file mode 100644 (file)
index 0000000..9e2ca40
--- /dev/null
@@ -0,0 +1,14 @@
+<qu>
+option "config_file" c
+#~~~~~~~~~~~~~~~~~~~~~
+"(default='</qu>DEFAULT_CONFIG_FILE<qu>'"
+string typestr="filename"
+optional
+details="
+       </qu>CURRENT_PROGRAM<qu> reads its config file right after parsing
+       the options that were given at the command line. If an
+       option is given both at the command line and in the
+       config file, the value that was specified at the command line
+       takes precedence.
+"
+</qu>
diff --git a/ggo/daemon.m4 b/ggo/daemon.m4
new file mode 100644 (file)
index 0000000..b4e842a
--- /dev/null
@@ -0,0 +1,11 @@
+<qu>
+option "daemon" d
+#~~~~~~~~~~~~~~~~
+"run as background daemon"
+flag off
+dependon="logfile"
+details="
+       Note that </qu>CURRENT_PROGRAM<qu> refuses to start in daemon mode if no
+       logfile was specified.
+"
+</qu>
diff --git a/ggo/filter.ggo b/ggo/filter.ggo
deleted file mode 100644 (file)
index e3ac59a..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-option "loglevel" l
-#~~~~~~~~~~~~~~~~~~
- "set loglevel (0-6)"
-int typestr="level"
-default="3"
-optional
-
-option "filter" f
-#~~~~~~~~~~~~~~~~
-"Specify filter."
-string typestr="filter_spec"
-optional
-multiple
-details="
-       May be given multiple times to 'pipe' the stream through
-       arbitrary many filters in an efficient way.  The same filter
-       may appear more than once, order matters.
-
-       Filter options may be specified for each '-f' option
-       separately. Note that you will have to quote these options
-       like this:
-
-               -f 'compress --inertia 5 --damp 2'
-"
diff --git a/ggo/filter.m4 b/ggo/filter.m4
new file mode 100644 (file)
index 0000000..4e99176
--- /dev/null
@@ -0,0 +1,21 @@
+include(header.m4)
+include(loglevel.m4)
+<qu>
+option "filter" f
+#~~~~~~~~~~~~~~~~
+"Specify filter."
+string typestr="filter_spec"
+optional
+multiple
+details="
+       May be given multiple times to 'pipe' the stream through
+       arbitrary many filters in an efficient way.  The same filter
+       may appear more than once, order matters.
+
+       Filter options may be specified for each '-f' option
+       separately. Note that you will have to quote these options
+       like this:
+
+               -f 'compress --inertia 5 --damp 2'
+"
+</qu>
diff --git a/ggo/fsck.ggo b/ggo/fsck.ggo
deleted file mode 100644 (file)
index eb7c627..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-option "loglevel" l
-#~~~~~~~~~~~~~~~~~~
-
-"set loglevel (0-6)"
-
-       int typestr="level"
-       default="2"
-       optional
-
-option "base_dir" b
-#~~~~~~~~~~~~~~~~~~
-"Full path to the database directory
-containing the table(s) to be checked.
-(default='~/.paraslash/afs_database'"
-
-       string typestr="path"
-       optional
-
-option "dump_dir" d
-#~~~~~~~~~~~~~~~~~~
-"If path is non-empty, para_fsck will write a
-dump of all given tables to the specified
-path."
-
-       string typestr="path"
-       optional
-       default=""
-
-option "no_fsck" n
-#~~~~~~~~~~~~~~~~~
-"Disable fsck mode."
-
-       flag off
-
-option "force" f
-#~~~~~~~~~~~~~~~
-"Force fsck even if the table is dirty.
-Ignored if -n is given."
-
-       flag off
-
-option "dry_run" -
-#~~~~~~~~~~~~~~~~~
-"Only report problems, don't try to fix them."
-
-       flag off
-
diff --git a/ggo/fsck.m4 b/ggo/fsck.m4
new file mode 100644 (file)
index 0000000..d593058
--- /dev/null
@@ -0,0 +1,43 @@
+include(header.m4)
+include(loglevel.m4)
+
+<qu>
+option "base_dir" b
+#~~~~~~~~~~~~~~~~~~
+"Full path to the database directory
+containing the table(s) to be checked.
+(default='~/.paraslash/afs_database'"
+
+       string typestr="path"
+       optional
+
+option "dump_dir" d
+#~~~~~~~~~~~~~~~~~~
+"If path is non-empty, para_fsck will write a
+dump of all given tables to the specified
+path."
+
+       string typestr="path"
+       optional
+       default=""
+
+option "no_fsck" n
+#~~~~~~~~~~~~~~~~~
+"Disable fsck mode."
+
+       flag off
+
+option "force" f
+#~~~~~~~~~~~~~~~
+"Force fsck even if the table is dirty.
+Ignored if -n is given."
+
+       flag off
+
+option "dry_run" -
+#~~~~~~~~~~~~~~~~~
+"Only report problems, don't try to fix them."
+
+       flag off
+
+</qu>
diff --git a/ggo/group.m4 b/ggo/group.m4
new file mode 100644 (file)
index 0000000..2a59ad9
--- /dev/null
@@ -0,0 +1,12 @@
+option "group" g
+#~~~~~~~~~~~~~~~
+"set group id"
+string typestr="group"
+optional
+details="
+       This option sets the group id according to 'group'. This option
+       is silently ignored if EUID != 0. Otherwise, real/effective
+       GID and the saved set-group ID are all set to the GID given by
+       'group'. Must not be given in the config file.
+"
+
diff --git a/ggo/gui.ggo b/ggo/gui.ggo
deleted file mode 100644 (file)
index a90d1b4..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-#------------------------
-section "general options"
-#------------------------
-
-option "config_file" c
-#~~~~~~~~~~~~~~~~~~~~~~
-"(default='~/.paraslash/gui.conf')"
-
-       string typestr="filename"
-       optional
-
-option "loglevel" l
-#~~~~~~~~~~~~~~~~~~
- "set loglevel (0-6)"
-int typestr="level"
-default="3"
-optional
-details="
-       See \"para_server --detailed-help\" for the discussion of
-       loglevels.
-"
-
-option "timeout" t
-#~~~~~~~~~~~~~~~~~
-"set timeout"
-
-       int typestr="milliseconds"
-       default="30"
-       optional
-
-option "stat_cmd" s
-#~~~~~~~~~~~~~~~~~~
-"command to read server and audiod status
-data from"
-
-       string typestr="command"
-       default="para_audioc stat"
-       optional
-
-#---------------------------------
-section "mapping keys to commands"
-#---------------------------------
-
-option "key_map" k
-#~~~~~~~~~~~~~~~~~
-
-"Map key k to command c using mode m. Mode
-may be d, x or p for display, external and
-paraslash commands, respectively. Of course,
-this option may be given multiple times, one
-for each key mapping."
-
-       string typestr="k:m:c"
-       optional
-       multiple
diff --git a/ggo/gui.m4 b/ggo/gui.m4
new file mode 100644 (file)
index 0000000..dd1e249
--- /dev/null
@@ -0,0 +1,47 @@
+include(header.m4)
+define(CURRENT_PROGRAM,para_gui)
+
+<qu>
+#########################
+section "general options"
+#########################
+</qu>
+
+include(config_file.m4)
+include(loglevel.m4)
+
+<qu>
+option "timeout" t
+#~~~~~~~~~~~~~~~~~
+"set timeout"
+
+       int typestr="milliseconds"
+       default="30"
+       optional
+
+option "stat_cmd" s
+#~~~~~~~~~~~~~~~~~~
+"command to read server and audiod status
+data from"
+
+       string typestr="command"
+       default="para_audioc stat"
+       optional
+
+#---------------------------------
+section "mapping keys to commands"
+#---------------------------------
+
+option "key_map" k
+#~~~~~~~~~~~~~~~~~
+
+"Map key k to command c using mode m. Mode
+may be d, x or p for display, external and
+paraslash commands, respectively. Of course,
+this option may be given multiple times, one
+for each key mapping."
+
+       string typestr="k:m:c"
+       optional
+       multiple
+</qu>
diff --git a/ggo/header.m4 b/ggo/header.m4
new file mode 100644 (file)
index 0000000..c423187
--- /dev/null
@@ -0,0 +1 @@
+changequote(<qu>,</qu>)
diff --git a/ggo/logfile.m4 b/ggo/logfile.m4
new file mode 100644 (file)
index 0000000..bb10293
--- /dev/null
@@ -0,0 +1,11 @@
+<qu>
+option "logfile" L
+#~~~~~~~~~~~~~~~~~
+"where to write log output"
+string typestr="filename"
+optional
+details="
+       If this option is not given, </qu>CURRENT_PROGRAM<qu> writes the log
+       messages to to stderr
+"
+</qu>
diff --git a/ggo/loglevel.m4 b/ggo/loglevel.m4
new file mode 100644 (file)
index 0000000..0badbf4
--- /dev/null
@@ -0,0 +1,22 @@
+<qu>
+option "loglevel" l
+#~~~~~~~~~~~~~~~~~~
+"set loglevel"
+string typestr="level"
+values = "debug","info","notice","warning","error","crit","emerg"
+default="warning"
+optional
+details="
+       Log only messages with severity greater or equal the given
+       value.
+
+       debug: Produces really noisy output.
+       info: Still noisy, but won't fill up the disk quicky.
+       notice: Indicates normal, but significant event.
+       warning: Unexpected events that can be handled.
+       error: Unhandled error condition.
+       crit: System might be unreliable.
+       emerg: Last message before exit.
+"
+
+</qu>
diff --git a/ggo/makefile b/ggo/makefile
new file mode 100644 (file)
index 0000000..4988d6f
--- /dev/null
@@ -0,0 +1,69 @@
+module_ggo_opts := --set-version="($(PACKAGE_STRING), $(codename))"
+
+grab_client.cmdline.h grab_client.cmdline.c: $(ggo_dir)/grab_client.ggo
+       gengetopt $(module_ggo_opts) \
+               -S \
+               --set-package=grab \
+               --no-handle-help \
+               --no-handle-error \
+               --no-handle-version \
+               --arg-struct-name=grab_client_args_info \
+               --file-name=$(subst .ggo,,$(<F)).cmdline \
+               --func-name $(subst .ggo,,$(<F))_cmdline_parser < $<
+
+%_recv.cmdline.h %_recv.cmdline.c: $(ggo_dir)/%_recv.ggo
+       gengetopt $(module_ggo_opts) \
+               --set-package=$(subst .ggo,,$(<F)) \
+               --arg-struct-name=$(subst .ggo,,$(<F))_args_info \
+               --file-name=$(subst .ggo,,$(<F)).cmdline \
+               --func-name $(subst .ggo,,$(<F))_cmdline_parser < $<
+
+%_filter.cmdline.h %_filter.cmdline.c: $(ggo_dir)/%_filter.ggo
+       gengetopt $(module_ggo_opts) \
+               --set-package=$(subst .ggo,,$(<F)) \
+               --arg-struct-name=$(subst .ggo,,$(<F))_args_info \
+               --file-name=$(subst .ggo,,$(<F)).cmdline \
+               --func-name $(subst _filter.ggo,,$(<F))_cmdline_parser < $<
+%_write.cmdline.h %_write.cmdline.c: $(ggo_dir)/%_write.ggo
+       gengetopt -S $(module_ggo_opts) \
+               --set-package=$(subst .ggo,,$(<F)) \
+               --arg-struct-name=$(subst .ggo,,$(<F))_args_info \
+               --file-name=$(subst .ggo,,$(<F)).cmdline \
+               --func-name $(subst _write.ggo,,$(<F))_cmdline_parser < $<
+
+%.cmdline.h %.cmdline.c: $(ggo_dir)/%.ggo
+       case $(<F) in client.ggo) O="--unamed-opts=command";; \
+               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";; \
+               audiod.ggo) O="--no-handle-help";; \
+       esac; \
+       if test $(<F) != fsck.ggo; then O="$$O --conf-parser "; fi; \
+       gengetopt $$O \
+               --no-handle-version \
+               --file-name=$(*F).cmdline \
+               --func-name $(*F)_cmdline_parser \
+               --arg-struct-name=$(*F)_args_info \
+               --set-package="para_$(subst .cmdline,,$(*F))" \
+               --set-version="$(PACKAGE_VERSION)"  < $<
+
+$(ggo_dir)/server.ggo $(ggo_dir)/audiod.ggo: \
+       $(ggo_dir)/loglevel.m4 $(ggo_dir)/color.m4 \
+       $(ggo_dir)/config_file.m4 $(ggo_dir)/logfile.m4 \
+       $(ggo_dir)/daemon.m4 $(ggo_dir)/user.m4 \
+       $(ggo_dir)/group.m4
+
+$(ggo_dir)/afh.ggo: $(ggo_dir)/loglevel.m4
+$(ggo_dir)/audioc.ggo: $(ggo_dir)/loglevel.m4
+$(ggo_dir)/filter.ggo: $(ggo_dir)/loglevel.m4
+$(ggo_dir)/fsck.ggo: $(ggo_dir)/loglevel.m4
+$(ggo_dir)/gui.ggo: $(ggo_dir)/loglevel.m4
+$(ggo_dir)/recv.ggo: $(ggo_dir)/loglevel.m4
+$(ggo_dir)/write.ggo: $(ggo_dir)/loglevel.m4
+$(ggo_dir)/client.ggo: $(ggo_dir)/loglevel.m4 $(ggo_dir)/config_file.m4
+
+$(ggo_dir)/%.ggo: $(ggo_dir)/%.m4 $(ggo_dir)/header.m4
+       (cd $(ggo_dir) && m4 $(<F)) > $@
diff --git a/ggo/recv.ggo b/ggo/recv.ggo
deleted file mode 100644 (file)
index 2f64761..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-option "loglevel" l
-#~~~~~~~~~~~~~~~~~~
-"set loglevel (0-6)"
-int typestr="level"
-default="3"
-optional
-
-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'
-"
-
diff --git a/ggo/recv.m4 b/ggo/recv.m4
new file mode 100644 (file)
index 0000000..9702e12
--- /dev/null
@@ -0,0 +1,16 @@
+include(header.m4)
+include(loglevel.m4)
+
+<qu>
+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'
+"
+</qu>
diff --git a/ggo/server.ggo b/ggo/server.ggo
deleted file mode 100644 (file)
index 055dbc1..0000000
+++ /dev/null
@@ -1,398 +0,0 @@
-#########################
-section "General options"
-#########################
-
-option "loglevel" l
-#~~~~~~~~~~~~~~~~~~
-"set loglevel (0-6)"
-int typestr="level"
-default="3"
-optional
-details="
-       Larger values mean less verbose output. Loglevel 0 (debug) gets
-       really noisy; a value of 1 (info) produces still noisy output,
-       but this won't fill up the disk quicky. Messaged logged with
-       loglevel 2 (notice) indicate normal but significant events
-       while level 3 (warning) logs unexpected events that can be
-       handled. Unhandled error conditions are logged with loglevel
-       4 (error) and crititcal errors are logged using loglevel 5
-       (crit). Finally, loglevel 6 (emerg) is reserved for messages
-       that cause para_server to terminate immediately.
-"
-
-option "color" C
-#~~~~~~~~~~~~~~~
-"activate color output"
-enum typestr="when"
-values = "yes","no","auto"
-default = "auto"
-optional
-
-option "log_color" -
-#~~~~~~~~~~~~~~~~~~~
-"select a color for one type of log message"
-string typestr="color_spec"
-multiple
-optional
-details="
-       The format of \"color_spec\" is [fg [bg]] [attr].
-
-       Valid colors for \"fg\" and \"bg\" are \"normal\", \"black\",
-       \"red\", \"green\", \"yellow\", \"blue\", \"magenta\",
-       \"cyan\", and \"white\".
-
-       The \"attr\" value must be one of \"bold\", \"dim\", \"ul\",
-       \"blink\", \"reverse\".
-
-       Examples:
-
-               --log_color \"debug:green\"
-               --log_color \"info:yellow bold\"
-               --log_color \"notice:white red bold\"
-"
-
-option "port" p
-#~~~~~~~~~~~~~~
-"listening port"
-int typestr="portnumber"
-default="2990"
-optional
-details="
-       para_server listens on this tcp port for incoming connections
-       from clients such as para_client. If the default port is
-       changed, the corresponding option of para_client must be used
-       to connect to para_server.
-"
-
-option "daemon" d
-#~~~~~~~~~~~~~~~~
-"run as background daemon"
-flag off
-dependon="logfile"
-details="
-       Note that para_server refuses to start in daemon mode if no
-       logfile was specified.
-"
-
-option "user" u
-#~~~~~~~~~~~~~~
-"run as the given user"
-string typestr="name"
-optional
-details="
-       para_server does not need any special privileges. If started
-       as root (EUID == 0) this option must be given at the command
-       line (not in the configuration file) so that para_server
-       can drop the root privileges right after parsing the command
-       line options, but before parsing the configuration file. In
-       this case, real/effective/saved UID are all set to the UID
-       of 'name'. As the configuration file is read afterwards,
-       those options that have a default value depending on the UID
-       (e.g. the directory for the configuration file) are computed
-       by using the uid of 'name'. This option has no effect if
-       para_server is started as a non-root user (i.e.  EUID != 0)
-"
-
-
-option "group" g
-#~~~~~~~~~~~~~~~
-"set group id"
-string typestr="group"
-optional
-details="
-       This option sets the group id according to 'group'. This option
-       is silently ignored if EUID != 0. Otherwise, real/effective
-       GID and the saved set-group ID are all set to the GID given by
-       'group'. Must not be given in the config file.
-"
-
-#############################
-section "Configuration files"
-#############################
-
-
-option "logfile" L
-#~~~~~~~~~~~~~~~~~
-"where to write log output"
-string typestr="filename"
-optional
-details="
-       If this option is not given, para_server writes the log
-       messages to to stderr
-"
-
-option "config_file" c
-#~~~~~~~~~~~~~~~~~~~~~
-"(default='~/.paraslash/server.conf'"
-string typestr="filename"
-optional
-details="
-       para_server reads its config file right after parsing
-       the options that were given at the command line. If an
-       option is given both at the command line and in the
-       config file, the value that was specified at the command line
-       takes precedence.
-"
-
-option "user_list" -
-#~~~~~~~~~~~~~~~~~~~
-"(default='~/.paraslash/server.users')"
-
-string typestr="filename"
-optional
-
-
-##################################
-section "virtual streaming system"
-##################################
-
-
-option "autoplay" a
-#~~~~~~~~~~~~~~~~~~
-"start playing on startup"
-flag off
-
-option "autoplay_delay" -
-#~~~~~~~~~~~~~~~~~~~~~~~~
-"time to wait before streaming"
-int typestr="ms"
-default="0"
-optional
-dependon="autoplay"
-details="
-       If para_server is started with the autoplay option, this option
-       may be used to set up a delay before para_server streams its
-       first audio file. This is useful for example if para_server
-       and para_audiod are started during system startup. The delay
-       time should be choosen large enough so that para_audiod is
-       already up when para_server starts to stream. Of course, this
-       option depends on the autoplay option.
-"
-option "announce_time" A
-#~~~~~~~~~~~~~~~~~~~~~~~
-"grace time for clients"
-
-int typestr="ms"
-default="300"
-optional
-details="
-       Clients such as para_audiod connect to para_server and execute
-       the stat command to find out whether an audio stream is
-       currently available. This sets the delay betweeen announcing
-       the stream via the output of the stat command and sending
-       the first chunk of data.
-"
-
-#############################
-section "audio file selector"
-#############################
-
-option "afs_database_dir" D
-#~~~~~~~~~~~~~~~~~~~~~~~~~~
-"location of the database"
-string typestr="path"
-optional
-details="
-       Where para_server should look for the osl database of the audio
-       file selector. The default is '~/.paraslash/afs_database'.
-"
-
-option "afs_socket" s
-#~~~~~~~~~~~~~~~~~~~~
-"Command socket for afs"
-string typestr="path"
-default="/var/paraslash/afs_command_socket"
-optional
-details="
-       For each server command that is handled by the audio file
-       selector, the child process of para_server connects to the
-       audio file selector via a local socket. This option specifies
-       the location of that socket in the file system.
-"
-option "afs_initial_mode" i
-#~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-"Mood or playlist to load on startup."
-string typestr="<specifier>/<name>"
-optional
-
-details="
-       The argument of this option must be prefixed with either 'p/'
-       or 'm/' to indicate whether a playlist or a mood should be
-       loaded. Example:
-               --afs_initial_mode p/foo
-       loads the playlist named 'foo'.
-"
-
-#####################
-section "http sender"
-#####################
-
-
-option "http_port" -
-#~~~~~~~~~~~~~~~~~~~
-"tcp port for http streaming"
-int typestr="portnumber"
-default="8000"
-optional
-details="
-       The http sender of para_server listens on this port for
-       incoming connections. Clients are expected to send the usual
-       http request message such as 'GET / HTTP/'.
-"
-
-option "http_default_deny" -
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~
-"make the http ACL a whitelist"
-flag off
-details="
-       The default is to use blacklists instead, i.e. connections
-       to the http sender are allowed unless the connecting host
-       matches a pattern given by a http_access option. This allows
-       to use access control the other way round: Connections are
-       denied from hosts which are not explicitly allowed by one or
-       more http_access options.
-"
-
-option "http_access" -
-#~~~~~~~~~~~~~~~~~~~~~
-"add an entry to the http ACL"
-string typestr="a.b.c.d/n"
-optional
-multiple
-details="
-       Add given host/network to access control list (whitelist if
-       http_default_deny was given, blacklist otherwise) before
-       opening the tcp port. This option can be given multiple
-       times. Example: '192.168.0.0/24' whitelists/blacklists the
-       256 hosts 192.168.0.x
-"
-
-option "http_no_autostart" -
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~
-"do not open tcp port on startup"
-flag off
-details="
-       If this option is given, the http sender does not listen on
-       its tcp port. It may be instructed to open this port at a
-       later time by using the sender command.
-"
-
-option "http_max_clients" -
-#~~~~~~~~~~~~~~~~~~~~~~~~~~
-"maximal number of connections"
-int typestr="number"
-default="-1"
-optional
-details="
-       The http sender will refuse connections if already that number
-       of clients are currently connected. A non-positive value
-       (the default) allows an unlimited number of simultaneous
-       connections.
-"
-
-#####################
-section "dccp sender"
-#####################
-
-
-option "dccp_port" -
-#~~~~~~~~~~~~~~~~~~~
-"port for dccp streaming"
-int typestr="portnumber"
-default="8000"
-optional
-details="
-       See http_port for details.
-"
-
-option "dccp_default_deny" -
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~
-"make the dccp ACL a whitelist"
-flag off
-details="
-       See http_default_deny for details.
-"
-
-option "dccp_access" -
-#~~~~~~~~~~~~~~~~~~~~~
-"add an entry to the dccp ACL"
-string typestr="a.b.c.d/n"
-optional
-multiple
-details="
-       See http_access for details.
-"
-
-option "dccp_max_clients" -
-#~~~~~~~~~~~~~~~~~~~~~~~~~~
-"maximal number of connections"
-int typestr="number"
-default="-1"
-optional
-details="
-       See http_max_clients for details.
-"
-
-####################
-section "udp sender"
-####################
-
-option "udp_target" -
-#~~~~~~~~~~~~~~~~~~~~
-"add udp target"
-string typestr="a.b.c.d:p"
-optional
-multiple
-details="
-       Add given host/port to the list of targets.  This option
-       can be given multiple times. Example: '224.0.1.38:1500'
-       instructs the udp sender to send to udp port 1500 on host
-       224.0.1.38 (unassigned ip in the Local Network Control Block
-       224.0.0/24). This is useful for multicast streaming.
-"
-
-option "udp_no_autostart" -
-#~~~~~~~~~~~~~~~~~~~~~~~~~~
-"do not start sending"
-flag off
-details="
-       If this option is given, udp streaming may be activated at
-       a later time by using the sender command.
-"
-
-option "udp_default_port" -
-#~~~~~~~~~~~~~~~~~~~~~~~~~~
-"udp port to send to"
-int typestr="port"
-default="8000"
-optional
-
-option "udp_header_interval" H
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-"duration for sending header"
-int typestr="ms"
-default="2000"
-optional
-details="
-       As the udp sender has no idea about connected clients it
-       sends the audio file header periodically if necessary. This
-       option is used to specify the duration of the interval between
-       sending the header. Shorter values decrease the average time
-       clients have to wait before being able to start playback,
-       but this also increases the amount network traffic. Note
-       that this affects only ogg vorbis streams as this is the only
-       audio format that needs an audio file header.
-"
-
-option "udp_ttl" t
-#~~~~~~~~~~~~~~~~~
-"set time to live value"
-int typestr="num"
-default="10"
-optional
-details="
-       This option instructs the udp sender to set the time to live to
-       \"num\" for the sending udp socket. Only useful for multicast
-       udp streaming.
-"
diff --git a/ggo/server.m4 b/ggo/server.m4
new file mode 100644 (file)
index 0000000..30c3b41
--- /dev/null
@@ -0,0 +1,302 @@
+include(header.m4)
+define(CURRENT_PROGRAM,para_server)
+define(DEFAULT_CONFIG_FILE,~/.paraslash/server.conf)
+
+<qu>
+#########################
+section "General options"
+#########################
+</qu>
+
+include(loglevel.m4)
+include(color.m4)
+include(daemon.m4)
+include(user.m4)
+include(group.m4)
+
+<qu>
+option "port" p
+#~~~~~~~~~~~~~~
+"listening port"
+int typestr="portnumber"
+default="2990"
+optional
+details="
+       para_server listens on this tcp port for incoming connections
+       from clients such as para_client. If the default port is
+       changed, the corresponding option of para_client must be used
+       to connect to para_server.
+"
+
+#############################
+section "Configuration files"
+#############################
+</qu>
+
+include(logfile.m4)
+include(config_file.m4)
+
+<qu>
+option "user_list" -
+#~~~~~~~~~~~~~~~~~~~
+"(default='~/.paraslash/server.users')"
+
+string typestr="filename"
+optional
+
+
+##################################
+section "virtual streaming system"
+##################################
+
+
+option "autoplay" a
+#~~~~~~~~~~~~~~~~~~
+"start playing on startup"
+flag off
+
+option "autoplay_delay" -
+#~~~~~~~~~~~~~~~~~~~~~~~~
+"time to wait before streaming"
+int typestr="ms"
+default="0"
+optional
+dependon="autoplay"
+details="
+       If para_server is started with the autoplay option, this option
+       may be used to set up a delay before para_server streams its
+       first audio file. This is useful for example if para_server
+       and para_audiod are started during system startup. The delay
+       time should be choosen large enough so that para_audiod is
+       already up when para_server starts to stream. Of course, this
+       option depends on the autoplay option.
+"
+option "announce_time" A
+#~~~~~~~~~~~~~~~~~~~~~~~
+"grace time for clients"
+
+int typestr="ms"
+default="300"
+optional
+details="
+       Clients such as para_audiod connect to para_server and execute
+       the stat command to find out whether an audio stream is
+       currently available. This sets the delay betweeen announcing
+       the stream via the output of the stat command and sending
+       the first chunk of data.
+"
+
+#############################
+section "audio file selector"
+#############################
+
+option "afs_database_dir" D
+#~~~~~~~~~~~~~~~~~~~~~~~~~~
+"location of the database"
+string typestr="path"
+optional
+details="
+       Where para_server should look for the osl database of the audio
+       file selector. The default is '~/.paraslash/afs_database'.
+"
+
+option "afs_socket" s
+#~~~~~~~~~~~~~~~~~~~~
+"Command socket for afs"
+string typestr="path"
+default="/var/paraslash/afs_command_socket"
+optional
+details="
+       For each server command that is handled by the audio file
+       selector, the child process of para_server connects to the
+       audio file selector via a local socket. This option specifies
+       the location of that socket in the file system.
+"
+option "afs_initial_mode" i
+#~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+"Mood or playlist to load on startup."
+string typestr="<specifier>/<name>"
+optional
+
+details="
+       The argument of this option must be prefixed with either 'p/'
+       or 'm/' to indicate whether a playlist or a mood should be
+       loaded. Example:
+               --afs_initial_mode p/foo
+       loads the playlist named 'foo'.
+"
+
+#####################
+section "http sender"
+#####################
+
+
+option "http_port" -
+#~~~~~~~~~~~~~~~~~~~
+"tcp port for http streaming"
+int typestr="portnumber"
+default="8000"
+optional
+details="
+       The http sender of para_server listens on this port for
+       incoming connections. Clients are expected to send the usual
+       http request message such as 'GET / HTTP/'.
+"
+
+option "http_default_deny" -
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~
+"make the http ACL a whitelist"
+flag off
+details="
+       The default is to use blacklists instead, i.e. connections
+       to the http sender are allowed unless the connecting host
+       matches a pattern given by a http_access option. This allows
+       to use access control the other way round: Connections are
+       denied from hosts which are not explicitly allowed by one or
+       more http_access options.
+"
+
+option "http_access" -
+#~~~~~~~~~~~~~~~~~~~~~
+"add an entry to the http ACL"
+string typestr="a.b.c.d/n"
+optional
+multiple
+details="
+       Add given host/network to access control list (whitelist if
+       http_default_deny was given, blacklist otherwise) before
+       opening the tcp port. This option can be given multiple
+       times. Example: '192.168.0.0/24' whitelists/blacklists the
+       256 hosts 192.168.0.x
+"
+
+option "http_no_autostart" -
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~
+"do not open tcp port on startup"
+flag off
+details="
+       If this option is given, the http sender does not listen on
+       its tcp port. It may be instructed to open this port at a
+       later time by using the sender command.
+"
+
+option "http_max_clients" -
+#~~~~~~~~~~~~~~~~~~~~~~~~~~
+"maximal number of connections"
+int typestr="number"
+default="-1"
+optional
+details="
+       The http sender will refuse connections if already that number
+       of clients are currently connected. A non-positive value
+       (the default) allows an unlimited number of simultaneous
+       connections.
+"
+
+#####################
+section "dccp sender"
+#####################
+
+
+option "dccp_port" -
+#~~~~~~~~~~~~~~~~~~~
+"port for dccp streaming"
+int typestr="portnumber"
+default="8000"
+optional
+details="
+       See http_port for details.
+"
+
+option "dccp_default_deny" -
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~
+"make the dccp ACL a whitelist"
+flag off
+details="
+       See http_default_deny for details.
+"
+
+option "dccp_access" -
+#~~~~~~~~~~~~~~~~~~~~~
+"add an entry to the dccp ACL"
+string typestr="a.b.c.d/n"
+optional
+multiple
+details="
+       See http_access for details.
+"
+
+option "dccp_max_clients" -
+#~~~~~~~~~~~~~~~~~~~~~~~~~~
+"maximal number of connections"
+int typestr="number"
+default="-1"
+optional
+details="
+       See http_max_clients for details.
+"
+
+####################
+section "udp sender"
+####################
+
+option "udp_target" -
+#~~~~~~~~~~~~~~~~~~~~
+"add udp target"
+string typestr="a.b.c.d:p"
+optional
+multiple
+details="
+       Add given host/port to the list of targets.  This option
+       can be given multiple times. Example: '224.0.1.38:1500'
+       instructs the udp sender to send to udp port 1500 on host
+       224.0.1.38 (unassigned ip in the Local Network Control Block
+       224.0.0/24). This is useful for multicast streaming.
+"
+
+option "udp_no_autostart" -
+#~~~~~~~~~~~~~~~~~~~~~~~~~~
+"do not start sending"
+flag off
+details="
+       If this option is given, udp streaming may be activated at
+       a later time by using the sender command.
+"
+
+option "udp_default_port" -
+#~~~~~~~~~~~~~~~~~~~~~~~~~~
+"udp port to send to"
+int typestr="port"
+default="8000"
+optional
+
+option "udp_header_interval" H
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+"duration for sending header"
+int typestr="ms"
+default="2000"
+optional
+details="
+       As the udp sender has no idea about connected clients it
+       sends the audio file header periodically if necessary. This
+       option is used to specify the duration of the interval between
+       sending the header. Shorter values decrease the average time
+       clients have to wait before being able to start playback,
+       but this also increases the amount network traffic. Note
+       that this affects only ogg vorbis streams as this is the only
+       audio format that needs an audio file header.
+"
+
+option "udp_ttl" t
+#~~~~~~~~~~~~~~~~~
+"set time to live value"
+int typestr="num"
+default="10"
+optional
+details="
+       This option instructs the udp sender to set the time to live to
+       \"num\" for the sending udp socket. Only useful for multicast
+       udp streaming.
+"
+</qu>
diff --git a/ggo/user.m4 b/ggo/user.m4
new file mode 100644 (file)
index 0000000..1bd5c59
--- /dev/null
@@ -0,0 +1,21 @@
+<qu>
+option "user" u
+#~~~~~~~~~~~~~~
+"run as the given user"
+string typestr="name"
+optional
+details="
+       </qu>CURRENT_PROGRAM<qu> does not need any special privileges.
+
+       If started as root (EUID == 0) this option must
+       be given at the command line (not in the configuration
+       file) so that </qu>CURRENT_PROGRAM<qu> can drop the root
+       privileges right after parsing the command line options,
+       but before parsing the configuration file. In this case,
+       real/effective/saved UID are all set to the UID of 'name'. As
+       the configuration file is read afterwards, those options that
+       have a default value depending on the UID (e.g. the directory
+       for the configuration file) are computed by using the uid of
+       'name'. This option has no effect if </qu>CURRENT_PROGRAM<qu>
+       is started as a non-root user (i.e.  EUID != 0).
+" </qu>
diff --git a/ggo/write.ggo b/ggo/write.ggo
deleted file mode 100644 (file)
index 8f557bb..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-option "loglevel" l
-#~~~~~~~~~~~~~~~~~~
-"set loglevel (0-6)"
-int typestr="level"
-default="4"
-optional
-
-option "bufsize" b
-#~~~~~~~~~~~~~~~~~
-"input buffer size"
-int typestr="kilobytes"
-default="64"
-optional
-
-option "writer" w
-#~~~~~~~~~~~~~~~~
-"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
-#~~~~~~~~~~~~~~~~~~~~
-"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.
-"
diff --git a/ggo/write.m4 b/ggo/write.m4
new file mode 100644 (file)
index 0000000..41e44dd
--- /dev/null
@@ -0,0 +1,31 @@
+include(header.m4)
+include(loglevel.m4)
+
+option "bufsize" b
+#~~~~~~~~~~~~~~~~~
+"input buffer size"
+int typestr="kilobytes"
+default="64"
+optional
+
+option "writer" w
+#~~~~~~~~~~~~~~~~
+"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
+#~~~~~~~~~~~~~~~~~~~~
+"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.
+"
diff --git a/gui.c b/gui.c
index f08976d2575d96afca710fb5d0b7b4bdd9246ab4..499845d9dadcdb6802b6ac49ab470d969729314c 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -489,12 +489,14 @@ static int add_output_line(char *line, __a_unused void *data)
        return 1;
 }
 
+static int loglevel;
+
 __printf_2_3 void para_log(int ll, const char *fmt,...)
 {
        int color;
        char *msg;
 
-       if (ll < conf.loglevel_arg || !curses_active)
+       if (ll < loglevel || !curses_active)
                return;
        switch (ll) {
                case LL_DEBUG:
@@ -562,8 +564,7 @@ __noreturn __printf_2_3 static void msg_n_exit(int ret, const char* fmt, ...)
 
 static void print_welcome(void)
 {
-       int ll = conf.loglevel_arg;
-       if (ll > LL_NOTICE)
+       if (loglevel > LL_NOTICE)
                return;
        outputf(COLOR_WELCOME, "Welcome to para_gui " PACKAGE_VERSION
                " \"" CODENAME "\". Theme: %s", theme.name);
@@ -1168,24 +1169,24 @@ err_out:
 
 static void com_ll_decr(void)
 {
-       if (conf.loglevel_arg <= LL_DEBUG) {
+       if (loglevel <= LL_DEBUG) {
                print_in_bar(COLOR_ERRMSG,
                        "loglevel already at maximal verbosity\n");
                return;
        }
-       conf.loglevel_arg--;
-       print_in_bar(COLOR_MSG, "loglevel set to %d\n", conf.loglevel_arg);
+       loglevel--;
+       print_in_bar(COLOR_MSG, "loglevel set to %d\n", loglevel);
 }
 
 static void com_ll_incr(void)
 {
-       if (conf.loglevel_arg >= LL_EMERG) {
+       if (loglevel >= LL_EMERG) {
                print_in_bar(COLOR_ERRMSG,
                        "loglevel already at miminal verbosity\n");
                return;
        }
-       conf.loglevel_arg++;
-       print_in_bar(COLOR_MSG, "loglevel set to %d\n", conf.loglevel_arg);
+       loglevel++;
+       print_in_bar(COLOR_MSG, "loglevel set to %d\n", loglevel);
 }
 
 /*
@@ -1391,6 +1392,7 @@ int main(int argc, char *argv[])
                };
                gui_cmdline_parser_config_file(cf, &conf, &params);
        }
+       loglevel = get_loglevel_by_name(conf.loglevel_arg);
        if (check_key_map_args() < 0) {
                fprintf(stderr, "invalid key map in config file\n");
                exit(EXIT_FAILURE);
diff --git a/recv.c b/recv.c
index 2386c1ef58930f140109918764acba5266c33a13..df8b9ce99e445f3acce568486c02878276f03576 100644 (file)
--- a/recv.c
+++ b/recv.c
 #include "recv.h"
 #include "recv.cmdline.h"
 #include "fd.h"
+#include "string.h"
 #include "error.h"
 #include "stdout.h"
 
 /** the gengetopt args info struct */
 struct recv_args_info conf;
 
-/** always log to stderr */
-INIT_STDERR_LOGGING(conf.loglevel_arg);
+static int loglevel;
+/** Always log to stderr. */
+INIT_STDERR_LOGGING(loglevel);
 
 /** init array of error codes used by para_recv */
 INIT_RECV_ERRLISTS;
@@ -85,6 +87,7 @@ int main(int argc, char *argv[])
                PARA_EMERG_LOG("parse failed\n");
                goto out;
        }
+       loglevel = get_loglevel_by_name(conf.loglevel_arg);
        r = &receivers[receiver_num];
        rn.receiver = r;
        ret = r->open(&rn);
index c11fb58a9cc234ee6316b3850b758b96286a65a7..4822ebb5c3066404e46f72b8154acc6f452bde04 100644 (file)
--- a/server.c
+++ b/server.c
@@ -202,7 +202,7 @@ err_out:
 void parse_config_or_die(int override)
 {
        char *home = para_homedir();
-       int ret, ll = conf.loglevel_arg;
+       int ret;
        char *cf;
 
        daemon_close_log();
@@ -237,7 +237,7 @@ void parse_config_or_die(int override)
                daemon_set_logfile(conf.logfile_arg);
                daemon_open_log_or_die();
        }
-       daemon_set_loglevel(ll);
+       daemon_set_loglevel(conf.loglevel_arg);
        init_colors_or_die();
        daemon_set_flag(DF_LOG_PID);
        daemon_set_flag(DF_LOG_LL);
@@ -491,7 +491,7 @@ static void server_init(int argc, char **argv)
        drop_privileges_or_die(conf.user_arg, conf.group_arg);
        /* parse config file, open log and set defaults */
        parse_config_or_die(0);
-       log_welcome("para_server", conf.loglevel_arg);
+       log_welcome("para_server");
        init_ipc_or_die(); /* init mmd struct and mmd->lock */
        /* make sure, the global now pointer is uptodate */
        gettimeofday(now, NULL);
index ba32e8bfbddc9b314cfcf78011b4f85bc6322906..3c80d27cc6b6ad73a95392c17cdb041837ec6ba5 100644 (file)
--- a/string.c
+++ b/string.c
@@ -586,3 +586,22 @@ int para_atoi32(const char *str, int32_t *value)
        *value = tmp;
        return 1;
 }
+
+int get_loglevel_by_name(const char *txt)
+{
+       if (!strcasecmp(txt, "debug"))
+               return LL_DEBUG;
+       if (!strcasecmp(txt, "info"))
+               return LL_INFO;
+       if (!strcasecmp(txt, "notice"))
+               return LL_NOTICE;
+       if (!strcasecmp(txt, "warning"))
+               return LL_WARNING;
+       if (!strcasecmp(txt, "error"))
+               return LL_ERROR;
+       if (!strcasecmp(txt, "crit"))
+               return LL_CRIT;
+       if (!strcasecmp(txt, "emerg"))
+               return LL_EMERG;
+       return -1;
+}
index 6a003330c41fbee82b11bc73cc72a2eb61faa2a8..77e62e907263b6c15e4d470f2dc86951d9581269 100644 (file)
--- a/string.h
+++ b/string.h
@@ -49,3 +49,4 @@ int for_each_line_ro(char *buf, size_t size, line_handler_t *line_handler,
        void *private_data);
 int para_atoi64(const char *str, int64_t *result);
 int para_atoi32(const char *str, int32_t *value);
+int get_loglevel_by_name(const char *txt);
diff --git a/write.c b/write.c
index e28e1c01e3f58a56fa8a745c5540ff319bf680be..238f2ab9d4d1c39f4b4b0e0bca46632c6c44762c 100644 (file)
--- a/write.c
+++ b/write.c
@@ -122,7 +122,8 @@ register_check_wav:
        s->timeout.tv_usec = 1;
 }
 
-INIT_STDERR_LOGGING(conf.loglevel_arg)
+static int loglevel;
+INIT_STDERR_LOGGING(loglevel)
 
 static struct writer_node_group *check_args(void)
 {
@@ -130,6 +131,7 @@ static struct writer_node_group *check_args(void)
        struct writer_node_group *g = NULL;
        struct initial_delay_task *idt = &the_initial_delay_task;
 
+       loglevel = get_loglevel_by_name(conf.loglevel_arg);
        if (conf.start_time_given) {
                long unsigned sec, usec;
                if (sscanf(conf.start_time_arg, "%lu:%lu",