diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2011-10-17 21:09:12 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2011-10-17 21:09:12 +0000 |
commit | cd90aa38151068c861041641b0e4e40b3afa4fae (patch) | |
tree | 12bfda26b4b359086eeb1a5912967b20a36934f0 /lib/libsndio/aucat.c | |
parent | e796f6ed824da5e9e191c2ab4bd774e6efa3392f (diff) |
Remove midicat since aucat can now be used instead of midicat
with almost the same syntax (roughly an extra -M option).
Thru boxes are created with aucat, and corresponding MIDI port
names have the "aucat" prefix instead of "midithru". The old
device name will still work some time for backward compatibility.
ok deraadt
Diffstat (limited to 'lib/libsndio/aucat.c')
-rw-r--r-- | lib/libsndio/aucat.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/lib/libsndio/aucat.c b/lib/libsndio/aucat.c index 6936a912ac6..7c563ea8ddb 100644 --- a/lib/libsndio/aucat.c +++ b/lib/libsndio/aucat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aucat.c,v 1.50 2011/10/05 16:15:43 ratchov Exp $ */ +/* $OpenBSD: aucat.c,v 1.51 2011/10/17 21:09:11 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -280,7 +280,7 @@ bad_gen: } int -aucat_connect_tcp(struct aucat *hdl, char *host, char *unit, int isaudio) +aucat_connect_tcp(struct aucat *hdl, char *host, char *unit) { int s, error, opt; struct addrinfo *ailist, *ai, aihints; @@ -291,11 +291,7 @@ aucat_connect_tcp(struct aucat *hdl, char *host, char *unit, int isaudio) DPRINTF("%s: bad unit number\n", unit); return 0; } - if (isaudio) - port += AUCAT_PORT; - else - port += MIDICAT_PORT; - snprintf(serv, sizeof(serv), "%u", port); + snprintf(serv, sizeof(serv), "%u", port + AUCAT_PORT); memset(&aihints, 0, sizeof(struct addrinfo)); aihints.ai_socktype = SOCK_STREAM; aihints.ai_protocol = IPPROTO_TCP; @@ -336,18 +332,16 @@ aucat_connect_tcp(struct aucat *hdl, char *host, char *unit, int isaudio) } int -aucat_connect_un(struct aucat *hdl, char *unit, int isaudio) +aucat_connect_un(struct aucat *hdl, char *unit) { struct sockaddr_un ca; socklen_t len = sizeof(struct sockaddr_un); - char *sock; uid_t uid; int s; uid = geteuid(); - sock = isaudio ? AUCAT_PATH : MIDICAT_PATH; snprintf(ca.sun_path, sizeof(ca.sun_path), - "/tmp/aucat-%u/%s%s", uid, sock, unit); + "/tmp/aucat-%u/%s%s", uid, AUCAT_PATH, unit); ca.sun_family = AF_UNIX; s = socket(AF_UNIX, SOCK_STREAM, 0); if (s < 0) @@ -358,7 +352,7 @@ aucat_connect_un(struct aucat *hdl, char *unit, int isaudio) DPERROR(ca.sun_path); /* try shared server */ snprintf(ca.sun_path, sizeof(ca.sun_path), - "/tmp/aucat/%s%s", sock, unit); + "/tmp/aucat/%s%s", AUCAT_PATH, unit); while (connect(s, (struct sockaddr *)&ca, len) < 0) { if (errno == EINTR) continue; @@ -373,7 +367,7 @@ aucat_connect_un(struct aucat *hdl, char *unit, int isaudio) } int -aucat_open(struct aucat *hdl, const char *str, unsigned mode, int isaudio) +aucat_open(struct aucat *hdl, const char *str, unsigned mode) { extern char *__progname; int eof, hashost; @@ -409,10 +403,10 @@ aucat_open(struct aucat *hdl, const char *str, unsigned mode, int isaudio) } DPRINTF("aucat_init: trying %s -> %s.%s\n", str, unit, opt); if (hashost) { - if (!aucat_connect_tcp(hdl, host, unit, isaudio)) + if (!aucat_connect_tcp(hdl, host, unit)) return 0; } else { - if (!aucat_connect_un(hdl, unit, isaudio)) + if (!aucat_connect_un(hdl, unit)) return 0; } if (fcntl(hdl->fd, F_SETFD, FD_CLOEXEC) < 0) { |