git: 55d98b024f25 - main - beep: Sort usage and man page options

From: Jose Luis Duran <jlduran_at_FreeBSD.org>
Date: Sat, 22 Nov 2025 17:32:00 UTC
The branch main has been updated by jlduran:

URL: https://cgit.FreeBSD.org/src/commit/?id=55d98b024f25403f60efe04f90a391014b6bc388

commit 55d98b024f25403f60efe04f90a391014b6bc388
Author:     Jose Luis Duran <jlduran@FreeBSD.org>
AuthorDate: 2025-11-19 15:59:25 +0000
Commit:     Jose Luis Duran <jlduran@FreeBSD.org>
CommitDate: 2025-11-22 17:28:46 +0000

    beep: Sort usage and man page options
    
    Sort usage and man page options, mention possible minimum and maximum
    values, fix punctuation marks, and cleanup the man page.
    
    PR:             291092
    Reviewed by:    pauamma_gundo.com, christos
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D53827
---
 usr.bin/beep/beep.1 | 55 ++++++++++++++++++++++++++++-------------------------
 usr.bin/beep/beep.c | 19 +++++++++---------
 2 files changed, 39 insertions(+), 35 deletions(-)

diff --git a/usr.bin/beep/beep.1 b/usr.bin/beep/beep.1
index 732f2ae261cd..a13d220a7882 100644
--- a/usr.bin/beep/beep.1
+++ b/usr.bin/beep/beep.1
@@ -21,53 +21,55 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd November 4, 2021
-.Dt beep 1
+.Dd November 19, 2025
+.Dt BEEP 1
 .Os
 .Sh NAME
 .Nm beep
 .Nd play a beep sound
 .Sh SYNOPSIS
 .Nm
-.Op Fl F Ar frequency
+.Op Fl Bh
 .Op Fl D Ar duration_ms
-.Op Fl r Ar sample_rate_hz
+.Op Fl F Ar frequency_hz
 .Op Fl d Ar oss_device
 .Op Fl g Ar gain
-.Op Fl B
-.Op Fl h
+.Op Fl r Ar sample_rate_hz
 .Sh DESCRIPTION
 The
 .Nm
-utility is used to playback a beep on the soundcard.
+utility is used to play a beep on the sound card.
 .Pp
 The options are as follows:
-.Bl -tag -width "-f device"
-.It Fl F
-Sets the center frequency of the beep in Hz.
-The default is 440 Hz .
-.It Fl D
-Sets the duration of the beep in milliseconds.
-The default is 150 ms .
-.It Fl d
-Sets the soundcard to use.
-The default is /dev/dsp .
-.It Fl r
-Sets the soundcard samplerate in Hz.
-The default is 48000 Hz.
-.It Fl g
-Sets the waveform gain, between 0 and 100 inclusively.
-The default is 75.
+.Bl -tag -width "-r sample_rate_hz"
 .It Fl B
 Runs the
 .Nm
 utility in the background.
+.It Fl D Ar duration_ms
+Sets the duration of the beep in milliseconds,
+between 50\~ms and 2000\~ms inclusively.
+The default is 150\~ms.
+.It Fl F Ar frequency_hz
+Sets the center frequency of the beep in Hz.
+The default is 440\~Hz.
+.It Fl d Ar oss_device
+Sets the OSS device to use.
+The default is
+.Pa /dev/dsp .
+.It Fl g Ar gain
+Sets the waveform gain, between 0 and 100 inclusively.
+The default is 75.
 .It Fl h
 Display summary of options.
+.It Fl r Ar sample_rate_hz
+Sets the sound card sample rate in Hz,
+between 8000\~Hz and 48000\~Hz inclusively.
+The default is 48000\~Hz.
 .El
 .Sh EXAMPLES
-.Pp
-Playback default beep sound using /dev/dsp .
+Play default beep sound on
+.Pa /dev/dsp :
 .Bl -tag -width Ds -offset indent
 .It $ beep
 .El
@@ -77,6 +79,7 @@ Playback default beep sound using /dev/dsp .
 .Sh HISTORY
 The
 .Nm
-utility first appeared in FreeBSD 14.0.
+utility first appeared in
+.Fx 14.0 .
 .Sh AUTHORS
 .An Hans Petter Selasky Aq Mt hselasky@FreeBSD.org
diff --git a/usr.bin/beep/beep.c b/usr.bin/beep/beep.c
index 9d274770ad75..d16ad5b699c3 100644
--- a/usr.bin/beep/beep.c
+++ b/usr.bin/beep/beep.c
@@ -133,20 +133,21 @@ wave_function_16(float phase, float power)
 static void
 usage(void)
 {
-	fprintf(stderr, "Usage: %s [parameters]\n"
-	    "\t" "-F <frequency in HZ, default %d Hz>\n"
+	fprintf(stderr, "Usage: %s [-Bh] [-D duration_ms] [-F frequency_hz] "
+	    "[-d oss_device] [-g gain] [-r sample_rate_hz]\n"
+	    "\t" "-B Run in background\n"
 	    "\t" "-D <duration in ms, from %d ms to %d ms, default %d ms>\n"
-	    "\t" "-r <sample rate in HZ, from %d Hz to %d Hz, default %d Hz>\n"
-	    "\t" "-d <OSS device (default %s)>\n"
+	    "\t" "-F <frequency in Hz, default %d Hz>\n"
+	    "\t" "-d <OSS device, default %s>\n"
 	    "\t" "-g <gain from %d to %d, default %d>\n"
-	    "\t" "-B Run in background\n"
-	    "\t" "-h Show usage\n",
+	    "\t" "-h Show usage\n"
+	    "\t" "-r <sample rate in Hz, from %d Hz to %d Hz, default %d Hz>\n",
 	    getprogname(),
-	    DEFAULT_HZ,
 	    DURATION_MIN, DURATION_MAX, DURATION_DEF,
-	    SAMPLE_RATE_MIN, SAMPLE_RATE_MAX, SAMPLE_RATE_DEF,
+	    DEFAULT_HZ,
 	    DEFAULT_DEVICE,
-	    GAIN_MIN, GAIN_MAX, GAIN_DEF);
+	    GAIN_MIN, GAIN_MAX, GAIN_DEF,
+	    SAMPLE_RATE_MIN, SAMPLE_RATE_MAX, SAMPLE_RATE_DEF);
 	exit(1);
 }