svn commit: r349346 - head/usr.sbin/kbdcontrol

Warner Losh imp at FreeBSD.org
Mon Jun 24 21:05:15 UTC 2019


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)


More information about the svn-src-all mailing list