summaryrefslogtreecommitdiffstats
path: root/usr.sbin/mixer
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>1997-09-29 06:38:49 +0000
committercharnier <charnier@FreeBSD.org>1997-09-29 06:38:49 +0000
commitbb93f8d912b75868f7f48861de83529e2c68e775 (patch)
treebfe38888b8277374a459ca292eacc59494c21d98 /usr.sbin/mixer
parent9ea568f16a4b7cb874bb07be983ddade01953d27 (diff)
downloadFreeBSD-src-bb93f8d912b75868f7f48861de83529e2c68e775.zip
FreeBSD-src-bb93f8d912b75868f7f48861de83529e2c68e775.tar.gz
Use err(3).
Diffstat (limited to 'usr.sbin/mixer')
-rw-r--r--usr.sbin/mixer/mixer.815
-rw-r--r--usr.sbin/mixer/mixer.c52
2 files changed, 31 insertions, 36 deletions
diff --git a/usr.sbin/mixer/mixer.8 b/usr.sbin/mixer/mixer.8
index ac6c475..ec031ee 100644
--- a/usr.sbin/mixer/mixer.8
+++ b/usr.sbin/mixer/mixer.8
@@ -126,11 +126,12 @@ The
command first appeared in
.Fx 2.0.5 .
.Sh AUTHORS
-Original source by Craig Metz
-.Aq cmetz@thor.tjhsst.edu
-and Hannu Savolainen.
-Mostly rewriten by John-Mark Gurney
-.Aq jmg@freebsd.org .
+Original source by
+.An Craig Metz Aq cmetz@thor.tjhsst.edu
+and
+.An Hannu Savolainen .
+Mostly rewriten by
+.An John-Mark Gurney Aq jmg@freebsd.org .
This
-manual page was written by Mike Pritchard
-.Aq mpp@FreeBSD.ORG .
+manual page was written by
+.An Mike Pritchard Aq mpp@FreeBSD.ORG .
diff --git a/usr.sbin/mixer/mixer.c b/usr.sbin/mixer/mixer.c
index 9af2472..d2fead4 100644
--- a/usr.sbin/mixer/mixer.c
+++ b/usr.sbin/mixer/mixer.c
@@ -11,8 +11,14 @@
* ditto for my modifications (John-Mark Gurney, 1997)
*/
-#include <stdio.h>
+#ifndef lint
+static const char rcsid[] =
+ "$Id$";
+#endif /* not lint */
+
+#include <err.h>
#include <fcntl.h>
+#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
@@ -33,7 +39,7 @@ usage(int devmask, int recmask)
{
int i, n;
- printf("usage:\tmixer [[dev [voll[:volr]] | recsrc | {^|+|-|=}rec recdev] ... ]\n");
+ printf("usage: mixer [[dev [voll[:volr]] | recsrc | {^|+|-|=}rec recdev] ... ]\n");
printf(" devices: ");
for (i = 0, n = 0; i < SOUND_MIXER_NRDEVICES; i++)
if ((1 << i) & devmask) {
@@ -104,23 +110,15 @@ main(int argc, char *argv[])
argc -= 2; argv += 2;
}
- if ((baz = open(name, O_RDWR)) < 0) {
- perror(name);
- exit(1);
- }
+ if ((baz = open(name, O_RDWR)) < 0)
+ err(1, "%s", name);
free(name);
- if (ioctl(baz, SOUND_MIXER_READ_DEVMASK, &devmask) == -1) {
- perror("SOUND_MIXER_READ_DEVMASK");
- exit(-1);
- }
- if (ioctl(baz, SOUND_MIXER_READ_RECMASK, &recmask) == -1) {
- perror("SOUND_MIXER_READ_RECMASK");
- exit(-1);
- }
- if (ioctl(baz, SOUND_MIXER_READ_RECSRC, &recsrc) == -1) {
- perror("SOUND_MIXER_READ_RECSRC");
- exit(-1);
- }
+ if (ioctl(baz, SOUND_MIXER_READ_DEVMASK, &devmask) == -1)
+ err(-1, "SOUND_MIXER_READ_DEVMASK");
+ if (ioctl(baz, SOUND_MIXER_READ_RECMASK, &recmask) == -1)
+ err(-1, "SOUND_MIXER_READ_RECMASK");
+ if (ioctl(baz, SOUND_MIXER_READ_RECSRC, &recsrc) == -1)
+ err(-1, "SOUND_MIXER_READ_RECSRC");
orecsrc = recsrc;
if (argc == 1) {
@@ -128,7 +126,7 @@ main(int argc, char *argv[])
if (!((1 << foo) & devmask))
continue;
if (ioctl(baz, MIXER_READ(foo),&bar)== -1) {
- perror("MIXER_READ");
+ warn("MIXER_READ");
continue;
}
printf("Mixer %-8s is currently set to %3d:%d\n", names[foo], bar & 0x7f, (bar >> 8) & 0x7f);
@@ -183,7 +181,7 @@ main(int argc, char *argv[])
switch(argc > 1 ? sscanf(argv[1], "%d:%d", &l, &r) : 0) {
case 0:
if (ioctl(baz, MIXER_READ(dev),&bar)== -1) {
- perror("MIXER_READ");
+ warn("MIXER_READ");
argc--; argv++;
continue;
}
@@ -209,7 +207,7 @@ main(int argc, char *argv[])
l |= r << 8;
if (ioctl(baz, MIXER_WRITE(dev), &l) == -1)
- perror("WRITE_MIXER");
+ warn("WRITE_MIXER");
argc -= 2; argv += 2;
break;
@@ -217,16 +215,12 @@ main(int argc, char *argv[])
}
if (orecsrc != recsrc)
- if (ioctl(baz, SOUND_MIXER_WRITE_RECSRC, &recsrc) == -1) {
- perror("SOUND_MIXER_WRITE_RECSRC");
- exit(-1);
- }
+ if (ioctl(baz, SOUND_MIXER_WRITE_RECSRC, &recsrc) == -1)
+ err(-1, "SOUND_MIXER_WRITE_RECSRC");
if (drecsrc) {
- if (ioctl(baz, SOUND_MIXER_READ_RECSRC, &recsrc) == -1) {
- perror("SOUND_MIXER_READ_RECSRC");
- exit(-1);
- }
+ if (ioctl(baz, SOUND_MIXER_READ_RECSRC, &recsrc) == -1)
+ err(-1, "SOUND_MIXER_READ_RECSRC");
print_recsrc(recsrc);
}
OpenPOWER on IntegriCloud