sndioctl: Add -q option to suppress output when setting variables

This commit is contained in:
Alexandre Ratchov 2020-04-16 14:52:54 +02:00
parent 2254b715af
commit a04ab3f18c
2 changed files with 11 additions and 5 deletions

View File

@ -23,7 +23,7 @@
.Sh SYNOPSIS
.Nm
.Bk -words
.Op Fl dimnv
.Op Fl dimnqv
.Op Fl f Ar device
.Op Ar command ...
.Ek
@ -49,6 +49,8 @@ instead of their values.
Monitor and display audio parameter changes.
.It Fl n
Suppress printing of the variable name.
.It Fl q
Suppress all printing when setting a variable.
.It Fl v
Enable verbose mode, a.k.a. multi-channel mode.
By default parameters affecting different channels

View File

@ -64,7 +64,7 @@ void onctl(void *, unsigned, unsigned);
struct sioctl_hdl *hdl;
struct info *infolist;
int i_flag = 0, v_flag = 0, m_flag = 0, n_flag = 0;
int i_flag = 0, v_flag = 0, m_flag = 0, n_flag = 0, q_flag = 0;
static inline int
isname_first(int c)
@ -855,7 +855,7 @@ main(int argc, char **argv)
struct pollfd *pfds;
int nfds, revents;
while ((c = getopt(argc, argv, "df:imnv")) != -1) {
while ((c = getopt(argc, argv, "df:imnqv")) != -1) {
switch (c) {
case 'd':
d_flag = 1;
@ -872,12 +872,15 @@ main(int argc, char **argv)
case 'n':
n_flag = 1;
break;
case 'q':
q_flag = 1;
break;
case 'v':
v_flag++;
break;
default:
fprintf(stderr, "usage: sndioctl "
"[-dimnv] [-f device] [command ...]\n");
"[-dimnqv] [-f device] [command ...]\n");
exit(1);
}
}
@ -913,7 +916,8 @@ main(int argc, char **argv)
}
}
commit();
list();
if (!q_flag)
list();
}
if (m_flag) {
pfds = malloc(sizeof(struct pollfd) * sioctl_nfds(hdl));