mixer

FreeBSD OSS mixer library implementation and a complete rewrite of mixer(8)
git clone git://git.margiolis.net/mixer.git
Log | Files | Refs | README | LICENSE

commit 3e4855da3bf8408f1f04ad94718ec667d9c03446
parent e49055d5ec08db674a4daa55b24d85f08da1ec74
Author: Christos Margiolis <christos@margiolis.net>
Date:   Sun, 20 Mar 2022 20:17:45 +0200

combine conditions

Diffstat:
Musr.sbin/mixer/mixer.c | 12+++++-------
1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/usr.sbin/mixer/mixer.c b/usr.sbin/mixer/mixer.c @@ -157,7 +157,8 @@ parse: printdev(m, 1); pall = 0; goto next; - } else if (shorthand) { + } else if (shorthand && ((*p >= '0' && *p <= '9') || + *p == '+' || *p == '-' || *p == '.')) { /* * Input: `dev=N` -> shorthand for `dev.volume=N`. * @@ -165,12 +166,9 @@ parse: * long as we're sure the very beginning is right, * mod_volume() will take care of parsing it properly. */ - if (*p == '+' || *p == '-' || *p == '.' || - (*p >= '0' && *p <= '9')) { - cp = mixer_get_ctl(m->dev, C_VOL); - cp->mod(cp->parent_dev, p); - goto next; - } + cp = mixer_get_ctl(m->dev, C_VOL); + cp->mod(cp->parent_dev, p); + goto next; } ctlstr = strsep(&p, "="); if ((cp = mixer_get_ctl_byname(m->dev, ctlstr)) == NULL) {