diff mbox

[i-g-t] testdisplay: Allow getopt to print error messages

Message ID 1381404199-10820-1-git-send-email-thomas.wood@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Thomas Wood Oct. 10, 2013, 11:23 a.m. UTC
By not assigning opterr, getopt will print its own error message that
includes information about whether an option is unknown or just requires
an additional argument.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
---
 tests/testdisplay.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Lespiau, Damien Oct. 11, 2013, 12:17 p.m. UTC | #1
On Thu, Oct 10, 2013 at 12:23:19PM +0100, Thomas Wood wrote:
> By not assigning opterr, getopt will print its own error message that
> includes information about whether an option is unknown or just requires
> an additional argument.
> 
> Signed-off-by: Thomas Wood <thomas.wood@intel.com>

Look good to me, pushed. Thanks for the patch.
diff mbox

Patch

diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index 0fcce19..a0f43e9 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -723,7 +723,6 @@  int main(int argc, char **argv)
 
 	enter_exec_path( argv );
 
-	opterr = 0;
 	while ((c = getopt(argc, argv, optstr)) != -1) {
 		switch (c) {
 		case '3':
@@ -771,7 +770,6 @@  int main(int argc, char **argv)
 			sscanf(optarg, "%d,%d", &specified_disp_id, &specified_mode_num);
 			break;
 		default:
-			fprintf(stderr, "unknown option %c\n", c);
 			/* fall through */
 		case 'h':
 			usage(argv[0]);