changeset 1635:93c5e6163f9b draft

Fix for mix from Isaac Dunham (who can actually test it). (I tweaked the curly brackets.) He says: In the channel selection loop, "if (TT.chan)" had been combined with a strcmp; the else conditionals were premised on if (TT.chan) alone. The help text had been only partially updated for a couple option changes.
author Rob Landley <rob@landley.net>
date Wed, 31 Dec 2014 22:38:48 -0600
parents 5fac2769a159
children e064dd8ff138
files toys/other/mix.c
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/toys/other/mix.c	Wed Dec 31 21:30:59 2014 -0600
+++ b/toys/other/mix.c	Wed Dec 31 22:38:48 2014 -0600
@@ -9,13 +9,13 @@
   bool "mix"
   default y
   help
-   usage: mix [-m DEV] [-d CHANNEL] [-l VOL] [-r RIGHT]
+   usage: mix [-d DEV] [-c CHANNEL] [-l VOL] [-r RIGHT]
 
    List OSS sound channels (module snd-mixer-oss), or set volume(s).
 
+   -c CHANNEL	Set/show volume of CHANNEL (default first channel found)
    -d DEV		Device node (default /dev/mixer)
    -l VOL		Volume level
-   -c CHANNEL	Set/show volume of CHANNEL (default first channel found)
    -r RIGHT	Volume of right stereo channel (with -r, -l sets left volume)
 */
 
@@ -41,8 +41,9 @@
 
   for (channel = 0; channel < SOUND_MIXER_NRDEVICES; channel++) {
     if ((1<<channel) & mask) {
-      if (TT.chan && !strcmp(channels[channel], TT.chan)) break;
-      else if (toys.optflags & FLAG_l) break;
+      if (TT.chan) {
+        if (!strcmp(channels[channel], TT.chan)) break;
+      } else if (toys.optflags & FLAG_l) break;
       else printf("%s\n", channels[channel]);
     }
   }