summaryrefslogtreecommitdiff
path: root/usr.bin/mixerctl
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2004-01-22 08:06:19 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2004-01-22 08:06:19 +0000
commit70f07030dfccaf1a4cd43c6d0511fa0e37418e9a (patch)
tree829cd2112ed3e512ca898ef80c0d0f57b12ed112 /usr.bin/mixerctl
parentacc5cd19f833a091b6fa82f5299946f07dedbcd8 (diff)
remove need for -w. ok beck deraadt
Diffstat (limited to 'usr.bin/mixerctl')
-rw-r--r--usr.bin/mixerctl/mixerctl.15
-rw-r--r--usr.bin/mixerctl/mixerctl.c80
2 files changed, 39 insertions, 46 deletions
diff --git a/usr.bin/mixerctl/mixerctl.1 b/usr.bin/mixerctl/mixerctl.1
index f5f103e099c..fb181cb7cde 100644
--- a/usr.bin/mixerctl/mixerctl.1
+++ b/usr.bin/mixerctl/mixerctl.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: mixerctl.1,v 1.19 2003/11/21 10:20:06 jmc Exp $
+.\" $OpenBSD: mixerctl.1,v 1.20 2004/01/22 08:06:18 tedu Exp $
.\" $NetBSD: mixerctl.1,v 1.8 1998/05/09 12:41:16 augustss Exp $
.\"
.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -52,7 +52,6 @@
.Nm mixerctl
.Op Fl q
.Pf \ \& Op Fl f Ar file
-.Fl w
.Xo
.Ar name Ns = Ns Ar value
.Op Ar ...
@@ -86,7 +85,7 @@ Enumerated values are shown in
.Dq []
and set values are shown in
.Dq {} .
-.It Fl w Ar name Ns = Ns Ar value
+.It Ar name Ns = Ns Ar value
Attempt to set the specified variable
.Ar name
to
diff --git a/usr.bin/mixerctl/mixerctl.c b/usr.bin/mixerctl/mixerctl.c
index fc1671a7a52..ba0d1db4bf5 100644
--- a/usr.bin/mixerctl/mixerctl.c
+++ b/usr.bin/mixerctl/mixerctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mixerctl.c,v 1.13 2003/11/21 10:20:06 jmc Exp $ */
+/* $OpenBSD: mixerctl.c,v 1.14 2004/01/22 08:06:18 tedu Exp $ */
/* $NetBSD: mixerctl.c,v 1.11 1998/04/27 16:55:23 augustss Exp $ */
/*
@@ -238,7 +238,7 @@ int
main(int argc, char **argv)
{
int fd, i, j, ch, pos;
- int aflag = 0, qflag = 0, wflag = 0, vflag = 0;
+ int aflag = 0, qflag = 0, vflag = 0;
char *file;
char *sep = "=";
mixer_devinfo_t dinfo;
@@ -254,7 +254,7 @@ main(int argc, char **argv)
aflag++;
break;
case 'w':
- wflag++;
+ /* compat */
break;
case 'v':
vflag++;
@@ -276,13 +276,14 @@ main(int argc, char **argv)
argc -= optind;
argv += optind;
- if ((fd = open(file, wflag ? O_RDWR : O_RDONLY)) < 0)
- err(1, "%s", file);
+ if ((fd = open(file, O_RDWR)) == -1)
+ if ((fd = open(file, O_RDONLY)) == -1)
+ err(1, "%s", file);
for(;;) {
- dinfo.index = ndev++;
- if (ioctl(fd, AUDIO_MIXER_DEVINFO, &dinfo) < 0)
- break;
+ dinfo.index = ndev++;
+ if (ioctl(fd, AUDIO_MIXER_DEVINFO, &dinfo) < 0)
+ break;
}
if (!ndev)
@@ -340,49 +341,42 @@ main(int argc, char **argv)
fields[i].name);
}
- if (!argc && aflag && !wflag) {
+ if (!argc && aflag) {
for(i = 0; fields[i].name; i++) {
prfield(&fields[i], sep, vflag);
fprintf(out, "\n");
}
} else if (argc > 0 && !aflag) {
struct field *p;
- if (wflag) {
- while(argc--) {
- char *q;
-
- if (q = strchr(*argv, '=')) {
- *q++ = 0;
- p = findfield(*argv);
- if (p == 0)
- warnx("field %s does not exist", *argv);
- else {
- val = *p->valp;
- if (rdfield(p, q)) {
- if (ioctl(fd, AUDIO_MIXER_WRITE, p->valp) < 0)
- warn("AUDIO_MIXER_WRITE");
- else if (sep && !qflag) {
- *p->valp = val;
- prfield(p, ": ", 0);
- ioctl(fd, AUDIO_MIXER_READ, p->valp);
- printf(" -> ");
- prfield(p, 0, 0);
- printf("\n");
- }
+
+ while(argc--) {
+ char *q;
+
+ if (q = strchr(*argv, '=')) {
+ *q++ = 0;
+ p = findfield(*argv);
+ if (p == NULL)
+ warnx("field %s does not exist", *argv);
+ else {
+ val = *p->valp;
+ if (rdfield(p, q)) {
+ if (ioctl(fd, AUDIO_MIXER_WRITE, p->valp) < 0)
+ warn("AUDIO_MIXER_WRITE");
+ else if (sep && !qflag) {
+ *p->valp = val;
+ prfield(p, ": ", 0);
+ ioctl(fd, AUDIO_MIXER_READ, p->valp);
+ printf(" -> ");
+ prfield(p, 0, 0);
+ printf("\n");
}
}
- } else
- warnx("No `=' in %s", *argv);
- argv++;
- }
- } else {
- while(argc--) {
+ }
+ argv++;
+ } else {
p = findfield(*argv);
- if (p == 0)
- warnx("field %s does not exist", *argv);
- else
- prfield(p, sep, vflag), fprintf(out, "\n");
- argv++;
+ prfield(p, sep, vflag);
+ fprintf(out, "\n");
}
}
} else
@@ -398,7 +392,7 @@ usage(void)
fprintf(stderr,
"usage: %s [-nv] [-f file] -a\n"
" %s [-nv] [-f file] name [...]\n"
- " %s [-q] [-f file] -w name=value [...]\n",
+ " %s [-q] [-f file] name=value [...]\n",
__progname, __progname, __progname);
exit(1);