aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2021-10-15 09:11:44 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2021-10-15 09:13:29 +0000
commit63dcf7fda2b0ec1a2f74406dd26a659914a0c17c (patch)
treedb0a7d8108f987882e4429d278e465621973b439 /usr.sbin
parent78df56ccfcb40013a3e6904bd6d39836220c3550 (diff)
downloadsrc-63dcf7fda2b0ec1a2f74406dd26a659914a0c17c.tar.gz
src-63dcf7fda2b0ec1a2f74406dd26a659914a0c17c.zip
mixer(8): Fix mixer status line for /dev/dspX.vpY mixer devices.
In some cases when passing /dev/dspX.vpY as mixer devices, m->ci.longname and m->ci.hw_info will be empty. Don't print any brackets and parentheses in this case. Differential Revision: https://reviews.freebsd.org/D32500 Submitted by: christos@ Sponsored by: NVIDIA Networking
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/mixer/mixer.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/usr.sbin/mixer/mixer.c b/usr.sbin/mixer/mixer.c
index c32b87fdb7f0..f0e0c2d3b22b 100644
--- a/usr.sbin/mixer/mixer.c
+++ b/usr.sbin/mixer/mixer.c
@@ -219,15 +219,23 @@ printminfo(struct mixer *m, int oflag)
if (oflag)
return;
- printf("%s: <%s> %s", m->mi.name, m->ci.longname, m->ci.hw_info);
- printf(" (");
+ printf("%s:", m->mi.name);
+ if (*m->ci.longname != '\0')
+ printf(" <%s>", m->ci.longname);
+ if (*m->ci.hw_info != '\0')
+ printf(" %s", m->ci.hw_info);
+
+ if (m->mode != 0)
+ printf(" (");
if (m->mode & MIX_MODE_PLAY)
printf("play");
if ((m->mode & playrec) == playrec)
printf("/");
if (m->mode & MIX_MODE_REC)
printf("rec");
- printf(")");
+ if (m->mode != 0)
+ printf(")");
+
if (m->f_default)
printf(" (default)");
printf("\n");