diff --git a/aucat/aucat.c b/aucat/aucat.c index ca59a95..0df6f39 100644 --- a/aucat/aucat.c +++ b/aucat/aucat.c @@ -429,17 +429,15 @@ main(int argc, char **argv) else prog++; if (strcmp(prog, PROG_AUCAT) == 0) { - optstr = "a:b:c:C:de:f:h:i:j:lL:m:Mno:q:r:s:t:U:v:w:x:z:"; + optstr = "b:c:C:de:f:h:i:j:m:no:q:r:t:v:w:x:z:"; usagestr = aucat_usage; } else if (strcmp(prog, PROG_SNDIOD) == 0) { optstr = "a:b:c:C:de:f:j:L:m:Mq:r:s:t:U:v:w:x:z:"; usagestr = sndiod_usage; background = 1; hold = 0; - } else { - fprintf(stderr, "%s: can't determine program to run\n", prog); - return 1; - } + } else + errx(1, "%s: can't determine program to run", prog); while ((c = getopt(argc, argv, optstr)) != -1) { switch (c) { @@ -553,9 +551,6 @@ main(int argc, char **argv) case 'M': mkdev("midithru", MODE_THRU, 0, 0, hold, 0); break; - case 'l': - background = 1; - break; default: fputs(usagestr, stderr); exit(1); diff --git a/aucat/dev.c b/aucat/dev.c index f15f305..5e2ffd7 100644 --- a/aucat/dev.c +++ b/aucat/dev.c @@ -373,7 +373,12 @@ dev_open(struct dev *d) d->ipar = par; d->opar = par; d->rate = rate; - d->round = rate; + /* + * block sizes in the resampling code are limited to + * 2^15, so use 1/15 of the rate, since all standard + * sample rates are multiple of 15 + */ + d->round = rate / 15; d->bufsz = 2 * d->round; } #ifdef DEBUG diff --git a/aucat/listen.c b/aucat/listen.c index e0ef304..b016541 100644 --- a/aucat/listen.c +++ b/aucat/listen.c @@ -62,10 +62,8 @@ listen_new_un(char *path) struct listen *f; sock = socket(AF_UNIX, SOCK_STREAM, 0); - if (sock < 0) { - perror("socket"); - exit(1); - } + if (sock < 0) + err(1, "socket"); if (unlink(path) < 0 && errno != ENOENT) { perror("unlink"); goto bad_close; @@ -83,10 +81,8 @@ listen_new_un(char *path) if (f == NULL) goto bad_close; f->path = strdup(path); - if (f->path == NULL) { - perror("strdup"); - exit(1); - } + if (f->path == NULL) + err(1, "strdup"); f->fd = sock; f->next = listen_list; listen_list = f; @@ -114,10 +110,8 @@ listen_new_tcp(char *addr, unsigned int port) aihints.ai_socktype = SOCK_STREAM; aihints.ai_protocol = IPPROTO_TCP; error = getaddrinfo(host, serv, &aihints, &ailist); - if (error) { - fprintf(stderr, "%s: %s\n", addr, gai_strerror(error)); - exit(1); - } + if (error) + errx(1, "%s: %s", addr, gai_strerror(error)); /* * for each address, try create a listening socket bound on diff --git a/aucat/opt.c b/aucat/opt.c index 74840e6..0145626 100644 --- a/aucat/opt.c +++ b/aucat/opt.c @@ -14,6 +14,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include #include #include #include @@ -37,22 +38,16 @@ opt_new(char *name, struct dev *dev, char c; for (len = 0; name[len] != '\0'; len++) { - if (len == OPT_NAMEMAX) { - fprintf(stderr, "%s: name too long\n", name); - exit(1); - } + if (len == OPT_NAMEMAX) + errx(1, "%s: name too long", name); c = name[len]; if ((c < 'a' || c > 'z') && - (c < 'A' || c > 'Z')) { - fprintf(stderr, "%s: '%c' not allowed\n", name, c); - exit(1); - } + (c < 'A' || c > 'Z')) + errx(1, "%s: '%c' not allowed", name, c); } o = malloc(sizeof(struct opt)); - if (o == NULL) { - perror("opt_new: malloc"); - exit(1); - } + if (o == NULL) + err(1, "opt_new: malloc"); if (mode & MODE_RECMASK) o->wpar = (mode & MODE_MON) ? *rpar : *wpar; if (mode & MODE_PLAY) @@ -65,10 +60,8 @@ opt_new(char *name, struct dev *dev, memcpy(o->name, name, len + 1); for (po = &opt_list; *po != NULL; po = &(*po)->next) { if (o->dev->num == (*po)->dev->num && - strcmp(o->name, (*po)->name) == 0) { - fprintf(stderr, "%s: already defined\n", o->name); - exit(1); - } + strcmp(o->name, (*po)->name) == 0) + errx(1, "%s: already defined", o->name); } o->next = NULL; *po = o;