summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2011-12-02 12:45:30 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2011-12-02 12:45:30 +0000
commit541b6fa683cd05a96ffc9229b3ee6cc3e28d8784 (patch)
tree1f3893c65b7d90abd57f694ec8af419e148be3ae /usr.bin
parent624a9da884b45f3a4be3d5c5715679db28633932 (diff)
don't use a "server" flag, just check if we expose sub-devices
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/aucat/aucat.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/usr.bin/aucat/aucat.c b/usr.bin/aucat/aucat.c
index 5f78557a05d..e8eae62da2b 100644
--- a/usr.bin/aucat/aucat.c
+++ b/usr.bin/aucat/aucat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aucat.c,v 1.127 2011/12/02 10:34:50 ratchov Exp $ */
+/* $OpenBSD: aucat.c,v 1.128 2011/12/02 12:45:29 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -373,7 +373,7 @@ int
main(int argc, char **argv)
{
char *prog, *optstr, *usagestr;
- int c, background, unit, server, active;
+ int c, background, unit, active;
char base[PATH_MAX], path[PATH_MAX];
unsigned mode, hdr, xrun, rate, join, mmc, vol;
unsigned hold, autovol, bufsz, round;
@@ -400,7 +400,6 @@ main(int argc, char **argv)
aparams_init(&ppar, 0, 1, DEFAULT_RATE);
aparams_init(&rpar, 0, 1, DEFAULT_RATE);
mode = MODE_MIDIMASK | MODE_PLAY | MODE_REC;
- server = 0;
#ifdef DEBUG
atexit(dbg_flush);
@@ -430,16 +429,14 @@ main(int argc, char **argv)
#endif
break;
case 'U':
- if (server)
- errx(1, "-U must come before server options");
+ if (listen_list)
+ errx(1, "-U must come before -L");
unit = strtonum(optarg, 0, MIDI_MAXCTL, &str);
if (str)
errx(1, "%s: unit number is %s", optarg, str);
- server = 1;
break;
case 'L':
listen_new_tcp(optarg, AUCAT_PORT + unit);
- server = 1;
break;
case 'm':
mode = opt_mode();
@@ -500,7 +497,6 @@ main(int argc, char **argv)
mkopt(optarg, d, &rpar, &ppar,
mode, vol, mmc, join);
/* XXX: set device rate, if never set */
- server = 1;
break;
case 'q':
d = mkdev(NULL, mode, bufsz, round, 1, autovol);
@@ -548,7 +544,7 @@ main(int argc, char **argv)
exit(1);
}
if (wav_list) {
- if (server)
+ if (opt_list || listen_list)
errx(1, "-io not allowed in server mode");
if ((d = dev_list) && d->next)
errx(1, "only one device allowed in non-server mode");
@@ -564,10 +560,9 @@ main(int argc, char **argv)
if (opt_byname("default", d->num))
continue;
mkopt("default", d, &rpar, &ppar, mode, vol, mmc, join);
- server = 1;
}
}
- if (server) {
+ if (opt_list) {
getbasepath(base, sizeof(base));
snprintf(path, PATH_MAX, "%s/%s%u", base, AUCAT_PATH, unit);
listen_new_un(path);
@@ -613,7 +608,7 @@ main(int argc, char **argv)
}
if (dev_list == NULL)
break;
- if (!server && !active)
+ if (!opt_list && !active)
break;
if (!file_poll())
break;
@@ -633,7 +628,7 @@ main(int argc, char **argv)
while (dev_list)
dev_del(dev_list);
filelist_done();
- if (server) {
+ if (opt_list) {
if (rmdir(base) < 0 && errno != ENOTEMPTY && errno != EPERM)
warn("rmdir(\"%s\")", base);
}