Hi all,

This patch removes the -h flag because it seems very rare in
OpenBSD programs, perhaps because options are usually already
documented in manuals, as is the case for radiusd.  Regardless
of the rest of the system, I don't think an -h flag does much
good for radiusd given how simple its options are.

Regarding the second part of this patch: passing unknown options
to radiusd won't make it exit ASAP, and the usage information
won't be printed, as shown here:

    % ./radiusd -asdjsaljdksad
    radiusd: unknown option -- a
    radiusd: unknown option -- s
    radiusd: unknown option -- j
    radiusd: unknown option -- s
    radiusd: unknown option -- a
    radiusd: unknown option -- l
    radiusd: unknown option -- j
    radiusd: unknown option -- k
    radiusd: unknown option -- s
    radiusd: unknown option -- a
    2015-08-24 15:43:43:WARNING: /etc/radiusd.conf: No such file or directory
    radiusd: config error

This patch makes this happen instead:

    % ./radiusd -asdjsaljdksad
    radiusd: unknown option -- a
    usage: radiusd [-dn] [-f file]

This is done 

Regards,
Michael



Index: radiusd.8
===================================================================
RCS file: /cvs/src/usr.sbin/radiusd/radiusd.8,v
retrieving revision 1.5
diff -u -p -r1.5 radiusd.8
--- radiusd.8   28 Jul 2015 08:41:30 -0000      1.5
+++ radiusd.8   24 Aug 2015 19:32:48 -0000
@@ -22,7 +22,7 @@
 .Nd Remote Authentication Dial In User Service (RADIUS) daemon
 .Sh SYNOPSIS
 .Nm radiusd
-.Op Fl dhn
+.Op Fl dn
 .Op Fl f Ar file
 .Sh DESCRIPTION
 The
@@ -39,8 +39,6 @@ instead of
 and produce some additional debugging output.
 .It Fl f Ar file
 Specify an alternative configuration file.
-.It Fl h
-Display usage text and exit.
 .It Fl n
 Configtest mode.
 Only check the configuration file for validity.
Index: radiusd.c
===================================================================
RCS file: /cvs/src/usr.sbin/radiusd/radiusd.c,v
retrieving revision 1.6
diff -u -p -r1.6 radiusd.c
--- radiusd.c   2 Aug 2015 23:27:50 -0000       1.6
+++ radiusd.c   24 Aug 2015 19:32:48 -0000
@@ -94,7 +94,7 @@ usage(void)
 {
        extern char *__progname;
 
-       fprintf(stderr, "usage: %s [-dhn] [-f file]\n", __progname);
+       fprintf(stderr, "usage: %s [-dn] [-f file]\n", __progname);
        exit(EX_USAGE);
 }
 
@@ -108,7 +108,7 @@ main(int argc, char *argv[])
        bool                     noaction = false;
        struct passwd           *pw;
 
-       while ((ch = getopt(argc, argv, "df:nh")) != -1)
+       while ((ch = getopt(argc, argv, "df:n")) != -1)
                switch (ch) {
                case 'd':
                        debug++;
@@ -122,7 +122,7 @@ main(int argc, char *argv[])
                        noaction = true;
                        break;
 
-               case 'h':
+               default:
                        usage();
                        /* NOTREACHED */
                }

Reply via email to