commit 4c0451536786ca83488c268aeacb0c1299f1d128
parent 8b62568de30fb40da917397286e55f03037700bd
Author: Christos Margiolis <christos@margiolis.net>
Date: Sun, 17 Oct 2021 15:17:58 +0300
mixer(8): add -h option
Diffstat:
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/usr.sbin/mixer/mixer.8 b/usr.sbin/mixer/mixer.8
@@ -22,7 +22,7 @@
.\" $FreeBSD$
.\"
-.Dd September 22, 2021
+.Dd October 17, 2021
.Dt mixer 8
.Os
.Sh NAME
@@ -39,6 +39,8 @@
.Op Fl d Ar unit
.Op Fl os
.Fl a
+.Nm
+.Fl h
.Sh DESCRIPTION
The
.Nm
@@ -58,6 +60,8 @@ at the number each mixer device has by running
Open
.Ar device
as the mixer device (see FILES).
+.It Fl h
+Print a help message to stderr.
.It Fl o
Print mixer values in a format suitable for use inside scripts. The
mixer's header (name, audio card name, ...) will not be printed.
diff --git a/usr.sbin/mixer/mixer.c b/usr.sbin/mixer/mixer.c
@@ -64,7 +64,7 @@ main(int argc, char *argv[])
int aflag = 0, dflag = 0, oflag = 0, sflag = 0;
int ch;
- while ((ch = getopt(argc, argv, "ad:f:os")) != -1) {
+ while ((ch = getopt(argc, argv, "ad:f:hos")) != -1) {
switch (ch) {
case 'a':
aflag = 1;
@@ -84,6 +84,7 @@ main(int argc, char *argv[])
case 's':
sflag = 1;
break;
+ case 'h': /* FALLTHROUGH */
case '?':
default:
usage();
@@ -173,9 +174,9 @@ next:
static void __dead2
usage(void)
{
- printf("usage: %1$s [-f device] [-d unit] [-os] [dev[.control[=value]]] ...\n"
- " %1$s [-d unit] [-os] -a\n",
- getprogname());
+ fprintf(stderr, "usage: %1$s [-f device] [-d unit] [-os] [dev[.control[=value]]] ...\n"
+ " %1$s [-d unit] [-os] -a\n"
+ " %1$s -h\n", getprogname());
exit(1);
}