diff options
author | mdodd <mdodd@FreeBSD.org> | 2005-04-13 07:11:54 +0000 |
---|---|---|
committer | mdodd <mdodd@FreeBSD.org> | 2005-04-13 07:11:54 +0000 |
commit | c94ee5f99fbf2245bfd5e5161fb2d3472845d3d6 (patch) | |
tree | 227aca9845709d8e3d8f13db49192546f2f77836 /usr.sbin | |
parent | 4aeb6a67e29d3e9491ed530e5a8bc23bdc9825f0 (diff) | |
download | FreeBSD-src-c94ee5f99fbf2245bfd5e5161fb2d3472845d3d6.zip FreeBSD-src-c94ee5f99fbf2245bfd5e5161fb2d3472845d3d6.tar.gz |
Add the -S flag which produces the -s output without
mixing field separators.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/mixer/mixer.8 | 10 | ||||
-rw-r--r-- | usr.sbin/mixer/mixer.c | 28 |
2 files changed, 26 insertions, 12 deletions
diff --git a/usr.sbin/mixer/mixer.8 b/usr.sbin/mixer/mixer.8 index b9aa2c9..aecedd4 100644 --- a/usr.sbin/mixer/mixer.8 +++ b/usr.sbin/mixer/mixer.8 @@ -36,7 +36,7 @@ .Sh SYNOPSIS .Nm .Op Fl f Ar device -.Op Fl s +.Op Fl s | Fl S .Oo .Ar dev .Sm off @@ -50,12 +50,12 @@ .Ar ... .Nm .Op Fl f Ar device -.Op Fl s +.Op Fl s | Fl S .Cm recsrc .Ar ... .Nm .Op Fl f Ar device -.Op Fl s +.Op Fl s | Fl S .Sm off .Bro .Cm ^ | + | - | = @@ -118,6 +118,10 @@ for use as the command-line arguments to a future invocation of .Nm (as above). .Pp +The +.Fl S +flag provides the above output without mixing field separators. +.Pp To change the recording device you use one of: .Bl -tag -width =rec -offset indent .It Cm ^rec diff --git a/usr.sbin/mixer/mixer.c b/usr.sbin/mixer/mixer.c index 7abac46..35772c5 100644 --- a/usr.sbin/mixer/mixer.c +++ b/usr.sbin/mixer/mixer.c @@ -33,9 +33,9 @@ usage(int devmask, int recmask) { int i, n; - printf("usage: mixer [-f device] [-s] [dev [+|-][voll[:[+|-]volr]] ...\n" - " mixer [-f device] [-s] recsrc ...\n" - " mixer [-f device] [-s] {^|+|-|=}rec rdev ... \n"); + printf("usage: mixer [-f device] [-s | -S] [dev [+|-][voll[:[+|-]volr]] ...\n" + " mixer [-f device] [-s | -S] recsrc ...\n" + " mixer [-f device] [-s | -S] {^|+|-|=}rec rdev ... \n"); printf(" devices: "); for (i = 0, n = 0; i < SOUND_MIXER_NRDEVICES; i++) if ((1 << i) & devmask) { @@ -89,7 +89,7 @@ main(int argc, char *argv[]) { int foo, bar, baz, dev; int devmask = 0, recmask = 0, recsrc = 0, orecsrc; - int dusage = 0, drecsrc = 0, shortflag = 0; + int dusage = 0, drecsrc = 0, shortflag = 0, Shortflag = 0; int l = 0, r = 0, t = 0; char lstr[5], rstr[5]; int n = 0, lrel = 0, rrel = 0; @@ -104,7 +104,7 @@ main(int argc, char *argv[]) else if (!strcmp(argv[0], "mixer3")) name = strdup("/dev/mixer2"); - while ((ch = getopt(argc, argv, "f:s")) != -1) + while ((ch = getopt(argc, argv, "f:sS")) != -1) switch (ch) { case 'f': name = strdup(optarg); @@ -112,6 +112,9 @@ main(int argc, char *argv[]) case 's': shortflag = 1; break; + case 'S': + Shortflag = 1; + break; default: dusage = 1; } @@ -137,7 +140,10 @@ main(int argc, char *argv[]) warn("MIXER_READ"); continue; } - if (shortflag) + if (Shortflag) + printf("%s:%d:%d ", names[foo], bar & 0x7f, + (bar >> 8) & 0x7f); + else if (shortflag) printf("%s %d:%d ", names[foo], bar & 0x7f, (bar >> 8) & 0x7f); else @@ -221,7 +227,10 @@ main(int argc, char *argv[]) argc--; argv++; continue; } - if (shortflag) + if (Shortflag) + printf("%s:%d:%d ", names[dev], bar & 0x7f, + (bar >> 8) & 0x7f); + else if (shortflag) printf("%s %d:%d ", names[dev], bar & 0x7f, (bar >> 8) & 0x7f); else @@ -253,8 +262,9 @@ main(int argc, char *argv[]) else if (r > 100) r = 100; - printf("Setting the mixer %s from %d:%d to %d:%d.\n", - names[dev], bar & 0x7f, (bar >> 8) & 0x7f, l, r); + if (!Shortflag) + printf("Setting the mixer %s from %d:%d to %d:%d.\n", + names[dev], bar & 0x7f, (bar >> 8) & 0x7f, l, r); l |= r << 8; if (ioctl(baz, MIXER_WRITE(dev), &l) == -1) |