sad

simple audio daemon
git clone git://git.2f30.org/sad.git
Log | Files | Refs | LICENSE

commit 20ab974626dbe14df09f6060a3604e8ca2c29a46
parent 7d484bfef637b1003d6d5dfeacbde23b84754cb5
Author: sin <sin@2f30.org>
Date:   Sat Dec 27 20:55:12 +0000

Add cmdline option to choose socket path

Diffstat:
sad.c | 22++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/sad.c b/sad.c @@ -11,11 +11,13 @@ #include <string.h> #include <unistd.h> +#include "arg.h" #include "sad.h" fd_set master; fd_set rfds; int fdmax; +char *argv0; static int servlisten(const char *name) @@ -89,16 +91,32 @@ playaudio(void) } } +static void +usage(void) +{ + fprintf(stderr, "usage: %s [-f sock]\n", argv0); + exit(1); +} + int -main(void) +main(int argc, char *argv[]) { struct timeval tv; int listenfd, clifd, n, i; + char *socketpath = "/tmp/sad-sock"; + + ARGBEGIN { + case 'f': + socketpath = EARGF(usage()); + break; + default: + usage(); + } ARGEND; FD_ZERO(&master); FD_ZERO(&rfds); - listenfd = servlisten("/tmp/sad-sock"); + listenfd = servlisten(socketpath); FD_SET(listenfd, &master); fdmax = listenfd;