Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Jun 2019 21:05:14 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r349346 - head/usr.sbin/kbdcontrol
Message-ID:  <201906242105.x5OL5Erv074614@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906242105.x5OL5Erv074614>