From 10e1cdd54decacd78a2ea841cb1a206c67a735d5 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 11 Feb 2023 18:11:36 -0800 Subject: Give a hint what is wrong before printing usage message Signed-off-by: Alan Coopersmith --- xvidtune.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/xvidtune.c b/xvidtune.c index 85cd9ce..7005957 100644 --- a/xvidtune.c +++ b/xvidtune.c @@ -1579,15 +1579,19 @@ main (int argc, char** argv) if( (!strcmp(argv[1], "-timeout")) ) { TestTimeout = ((unsigned long) atol( argv[2] )) * 1000L; } - else + else { + fprintf(stderr, "Invalid number of arguments\n\n"); usage(1); + } } if (argc > 1) { int i = 0; - if (argc != 2) - usage(1); + if (argc != 2) { + fprintf(stderr, "Invalid number of arguments\n\n"); + usage(1); + } if (!strcmp(argv[1], "-show")) { if (!GetModeLine(XtDisplay (top), DefaultScreen (XtDisplay (top)))) { fprintf(stderr, "Unable to get mode info\n"); @@ -1604,8 +1608,10 @@ main (int argc, char** argv) CleanUp(XtDisplay (top)); XSync(XtDisplay (top), True); return 0; - } else - usage(1); + } else { + fprintf(stderr, "Unknown argument: %s\n\n", argv[1]); + usage(1); + } if (i != 0) { XF86VidModeSwitchMode(XtDisplay (top), DefaultScreen (XtDisplay (top)), i); -- cgit v1.2.3