summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2013-07-26 16:16:00 +0200
committerJaroslav Kysela <perex@perex.cz>2013-09-16 14:14:41 +0200
commit87bcda4b8a12d0fabab0bf4b0c1197089d2f9c4c (patch)
treec8106189daf45a15d877330a9ae4723312613182
parent719faff80962a5d93c09980673f08048ae58add6 (diff)
downloadalsa-utils-87bcda4b8a12d0fabab0bf4b0c1197089d2f9c4c.tar.gz
alsaloop: add -z,--syslog option to use syslog for errors
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r--alsaloop/alsaloop.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/alsaloop/alsaloop.c b/alsaloop/alsaloop.c
index 20150dd..3b20682 100644
--- a/alsaloop/alsaloop.c
+++ b/alsaloop/alsaloop.c
@@ -195,6 +195,7 @@ void help(void)
"-w,--workaround use workaround (serialopen)\n"
"-U,--xrun xrun profiling\n"
"-W,--wake process wake timeout in ms\n"
+"-z,--syslog use syslog for errors\n"
);
printf("\nRecognized sample formats are:");
for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) {
@@ -334,6 +335,14 @@ static int add_oss_mixers(struct loopback *loop,
return 0;
}
+static void enable_syslog(void)
+{
+ if (!use_syslog) {
+ use_syslog = 1;
+ openlog("alsaloop", LOG_NDELAY|LOG_PID, LOG_DAEMON);
+ }
+}
+
static int parse_config_file(const char *file, snd_output_t *output);
static int parse_config(int argc, char *argv[], snd_output_t *output,
@@ -368,6 +377,7 @@ static int parse_config(int argc, char *argv[], snd_output_t *output,
{"ossmixer", 1, NULL, 'O'},
{"workaround", 1, NULL, 'w'},
{"xrun", 0, NULL, 'U'},
+ {"syslog", 0, NULL, 'z'},
{NULL, 0, NULL, 0},
};
int err, morehelp;
@@ -405,7 +415,7 @@ static int parse_config(int argc, char *argv[], snd_output_t *output,
while (1) {
int c;
if ((c = getopt_long(argc, argv,
- "hdg:P:C:X:Y:l:t:F:f:c:r:s:benvA:S:a:m:T:O:w:UW:",
+ "hdg:P:C:X:Y:l:t:F:f:c:r:s:benvA:S:a:m:T:O:w:UW:z",
long_option, NULL)) < 0)
break;
switch (c) {
@@ -417,8 +427,7 @@ static int parse_config(int argc, char *argv[], snd_output_t *output,
break;
case 'd':
daemonize = 1;
- use_syslog = 1;
- openlog("alsaloop", LOG_NDELAY|LOG_PID, LOG_DAEMON);
+ enable_syslog();
break;
case 'P':
arg_pdevice = strdup(optarg);
@@ -561,6 +570,9 @@ static int parse_config(int argc, char *argv[], snd_output_t *output,
if (cmdline)
arg_default_wake = arg_wake;
break;
+ case 'z':
+ enable_syslog();
+ break;
}
}