Author: imp
Date: Mon Jun 24 21:05:14 2019
New Revision: 349346
URL: https://svnweb.freebsd.org/changeset/base/349346

Log:
  kbdcontrol -h prints two error messages.
  
  We loop through getopt(3) twice. Once for -P args and once for the
  rest. Catch '?' and print usage when that happens.

Modified:
  head/usr.sbin/kbdcontrol/kbdcontrol.c

Modified: head/usr.sbin/kbdcontrol/kbdcontrol.c
==============================================================================
--- head/usr.sbin/kbdcontrol/kbdcontrol.c       Mon Jun 24 21:00:28 2019        
(r349345)
+++ head/usr.sbin/kbdcontrol/kbdcontrol.c       Mon Jun 24 21:05:14 2019        
(r349346)
@@ -1220,9 +1220,12 @@ main(int argc, char **argv)
        int             opt;
 
        /* Collect any -P arguments, regardless of where they appear. */
-       while ((opt = getopt(argc, argv, optstring)) != -1)
+       while ((opt = getopt(argc, argv, optstring)) != -1) {
                if (opt == 'P')
                        add_keymap_path(optarg);
+               if (opt == '?')
+                       usage();
+       }
 
        optind = optreset = 1;
        while ((opt = getopt(argc, argv, optstring)) != -1)
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to