Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Feb 2020 21:29:59 +0000 (UTC)
From:      Rebecca Cran <bcran@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r358183 - head/usr.bin/dtc
Message-ID:  <202002202129.01KLTxKF009349@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bcran
Date: Thu Feb 20 21:29:59 2020
New Revision: 358183
URL: https://svnweb.freebsd.org/changeset/base/358183

Log:
  dtc: remove unknown option printf, since getopt will print it
  
  Since we don't set opterr to 0, getopt prints a message when it
  encounters an unknown/invalid option. We therefore don't need to
  print our own message in the default handler.
  
  Reviewed by:	kevans, theraven
  Differential Revision:	https://reviews.freebsd.org/D23662

Modified:
  head/usr.bin/dtc/dtc.cc

Modified: head/usr.bin/dtc/dtc.cc
==============================================================================
--- head/usr.bin/dtc/dtc.cc	Thu Feb 20 21:25:12 2020	(r358182)
+++ head/usr.bin/dtc/dtc.cc	Thu Feb 20 21:29:59 2020	(r358183)
@@ -304,7 +304,10 @@ main(int argc, char **argv)
 			}
 			break;
 		default:
-			fprintf(stderr, "Unknown option %c\n", ch);
+			/* 
+			 * Since opterr is non-zero, getopt will have
+			 * already printed an error message.
+			 */
 			return EXIT_FAILURE;
 		}
 	}



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