diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2009-02-06 08:26:35 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2009-02-06 08:26:35 +0000 |
commit | ab1f036c3ce84d881366ec56ce777caa5d20ee41 (patch) | |
tree | 5b299436471ab9d7dbd76bf303f084b1beaaf1eb /usr.bin/aucat/aucat.c | |
parent | 1739b3246b297c58796b4c861336f866c65e6fea (diff) |
move error messages reported to user into main()
Diffstat (limited to 'usr.bin/aucat/aucat.c')
-rw-r--r-- | usr.bin/aucat/aucat.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/usr.bin/aucat/aucat.c b/usr.bin/aucat/aucat.c index 21947cd89b9..3982d3521c4 100644 --- a/usr.bin/aucat/aucat.c +++ b/usr.bin/aucat/aucat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aucat.c,v 1.57 2009/02/04 20:35:14 ratchov Exp $ */ +/* $OpenBSD: aucat.c,v 1.58 2009/02/06 08:26:34 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -458,9 +458,11 @@ main(int argc, char **argv) errx(1, "can't use -l, -m and -s with -o or -i"); if (!mode) { if (l_flag || !SLIST_EMPTY(&ifiles)) - mode |= MODE_PLAY; + mode |= MODE_PLAY; if (l_flag || !SLIST_EMPTY(&ofiles)) mode |= MODE_REC; + if (!mode) + errx(1, "nothing to play or record"); } if (n_flag) { if (devpath != NULL || l_flag) @@ -536,10 +538,13 @@ main(int argc, char **argv) if (n_flag) { dev_loopinit(&dipar, &dopar, bufsz); } else { - dev_init(devpath, - (mode & MODE_REC) ? &dipar : NULL, - (mode & MODE_PLAY) ? &dopar : NULL, - bufsz); + if (!dev_init(devpath, + (mode & MODE_REC) ? &dipar : NULL, + (mode & MODE_PLAY) ? &dopar : NULL, + bufsz)) { + errx(1, "%s: can't open device", + devpath ? devpath : "<default>"); + } } /* |