aboutsummaryrefslogtreecommitdiff
path: root/toys/other/mix.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2018-11-02 20:07:02 -0500
committerRob Landley <rob@landley.net>2018-11-02 20:07:02 -0500
commit6a73e13d75d31da2c3f1145d8487725f0073a4b8 (patch)
tree17b5bb8b6b5e94b1c93818954cf322a39941a4be /toys/other/mix.c
parent49e1d8733ebcaf130623c68a2393a3c43702a524 (diff)
downloadtoybox-6a73e13d75d31da2c3f1145d8487725f0073a4b8.tar.gz
Convert more option vars to the new (single letter) coding style.
Diffstat (limited to 'toys/other/mix.c')
-rw-r--r--toys/other/mix.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/toys/other/mix.c b/toys/other/mix.c
index 845aac1f..d0f65618 100644
--- a/toys/other/mix.c
+++ b/toys/other/mix.c
@@ -24,10 +24,8 @@ config MIX
#include <linux/soundcard.h>
GLOBALS(
- long right;
- long level;
- char *dev;
- char *chan;
+ long r, l;
+ char *d, *c;
)
void mix_main(void)
@@ -35,31 +33,31 @@ void mix_main(void)
const char *channels[SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_NAMES;
int mask, channel = -1, level, fd;
- if (!TT.dev) TT.dev = "/dev/mixer";
- fd = xopen(TT.dev, O_RDWR|O_NONBLOCK);
+ if (!TT.d) TT.d = "/dev/mixer";
+ fd = xopen(TT.d, O_RDWR|O_NONBLOCK);
xioctl(fd, SOUND_MIXER_READ_DEVMASK, &mask);
for (channel = 0; channel < SOUND_MIXER_NRDEVICES; channel++) {
if ((1<<channel) & mask) {
- if (TT.chan) {
- if (!strcmp(channels[channel], TT.chan)) break;
+ if (TT.c) {
+ if (!strcmp(channels[channel], TT.c)) break;
} else if (toys.optflags & FLAG_l) break;
else printf("%s\n", channels[channel]);
}
}
if (!(toys.optflags & (FLAG_c|FLAG_l))) return;
- else if (channel == SOUND_MIXER_NRDEVICES) error_exit("bad -c '%s'", TT.chan);
+ else if (channel == SOUND_MIXER_NRDEVICES) error_exit("bad -c '%s'", TT.c);
if (!(toys.optflags & FLAG_l)) {
xioctl(fd, MIXER_READ(channel), &level);
if (level > 0xFF)
xprintf("%s:%s = left:%d\t right:%d\n",
- TT.dev, channels[channel], level>>8, level & 0xFF);
- else xprintf("%s:%s = %d\n", TT.dev, channels[channel], level);
+ TT.d, channels[channel], level>>8, level & 0xFF);
+ else xprintf("%s:%s = %d\n", TT.d, channels[channel], level);
} else {
- level = TT.level;
- if (!(toys.optflags & FLAG_r)) level = TT.right | (level<<8);
+ level = TT.l;
+ if (!(toys.optflags & FLAG_r)) level = TT.r | (level<<8);
xioctl(fd, MIXER_WRITE(channel), &level);
}