iwmbtfw(8): fix getopt flags, unify usage()/manual page contents

Seems like there was an intention to use command line switches
-m, -p and -v (each with argument), but there is no handling
for them.

Also, some enhancements to the usage()/manpage:

 - use FreeBSD manpage style -- square brackets -- for denoting
   optional arguments in usage();

 - show default directory path in usage();

 - update manual: -f is the optional flag;

 - show descriptions for -I/-D together: they are logically related.

Signed-off-by:	Eygene Ryabinkin <rea@FreeBSD.org>
Reviewed by:	wulf
MFC after:	1 month

(cherry picked from commit 0feaf865ce)
This commit is contained in:
Eygene Ryabinkin 2025-01-30 00:56:41 +03:00 • committed by Vladimir Kondratyev
parent f2591781f3
commit 666f8246c3
2 changed files with 7 additions and 6 deletions

View file

@ -36,7 +36,7 @@
.Nm
.Op Fl DI
.Fl d Ar device_name
.Fl f Ar firmware_path
.Op Fl f Ar firmware_path
.Nm
.Fl h
.Sh DESCRIPTION
@ -66,6 +66,8 @@ configuration to load in at runtime.
.Pp
The options are as follows:
.Bl -tag -width "-f firmware_path"
.It Fl I
Enable informational debugging.
.It Fl D
Enable verbose debugging.
.It Fl d Ar device_name
@ -76,8 +78,6 @@ device name.
Specify the directory containing the firmware files to search and upload.
.It Fl h
Display usage message and exit.
.It Fl I
Enable informational debugging.
.El
.Sh EXIT STATUS
.Ex -std

View file

@ -369,10 +369,11 @@ static void
usage(void)
{
fprintf(stderr,
"Usage: iwmbtfw (-D) -d ugenX.Y (-f firmware path) (-I)\n");
"Usage: iwmbtfw [-DI] -d ugenX.Y [-f firmware path]\n");
fprintf(stderr, " -D: enable debugging\n");
fprintf(stderr, " -d: device to operate upon\n");
fprintf(stderr, " -f: firmware path, if not default\n");
fprintf(stderr, " -f: firmware path (defaults to %s)\n",
_DEFAULT_IWMBT_FIRMWARE_PATH);
fprintf(stderr, " -I: enable informational output\n");
exit(127);
}
@ -652,7 +653,7 @@ main(int argc, char *argv[])
enum iwmbt_device iwmbt_device;
/* Parse command line arguments */
while ((n = getopt(argc, argv, "Dd:f:hIm:p:v:")) != -1) {
while ((n = getopt(argc, argv, "Dd:f:hI")) != -1) {
switch (n) {
case 'd': /* ugen device name */
devid_set = 1;