summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2014-06-03 23:36:56 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2014-06-03 23:36:56 -0700
commit5f47bf1a212b957009a85207338ee5b1d6ec6340 (patch)
treefba1cee39c4d5fa9401ab8fb5e2c13385c6edde0
parent9798300fc71af02f8725bc7b4da47a4b8676f5ab (diff)
Print which option was in error along with usage message
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--configure.ac2
-rw-r--r--xvinfo.c15
2 files changed, 12 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index b1bc647..1592c22 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,7 +38,7 @@ XORG_MACROS_VERSION(1.8)
XORG_DEFAULT_OPTIONS
# Checks for pkg-config packages
-PKG_CHECK_MODULES(XVINFO, [xv x11 xproto >= 7.0.17])
+PKG_CHECK_MODULES(XVINFO, [xv x11 xproto >= 7.0.25])
AC_CONFIG_FILES([
Makefile
diff --git a/xvinfo.c b/xvinfo.c
index 951ab22..891c8c2 100644
--- a/xvinfo.c
+++ b/xvinfo.c
@@ -12,10 +12,11 @@
static char *progname;
-static void _X_NORETURN
+static void _X_NORETURN _X_COLD
PrintUsage(void)
{
- fprintf(stderr, "Usage: %s [-display host:dpy] [-short] [-version]\n", progname);
+ fprintf(stderr, "Usage: %s [-display host:dpy] [-short] [-version]\n",
+ progname);
exit(0);
}
@@ -43,8 +44,12 @@ main(int argc, char *argv[])
if (argc != 1) {
for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "-display")) {
- disname = argv[i + 1];
- i++;
+ if (++i >= argc) {
+ fprintf (stderr, "%s: missing argument to -display\n",
+ progname);
+ PrintUsage();
+ }
+ disname = argv[i];
}
else if (!strcmp(argv[i], "-short"))
shortmode = 1;
@@ -53,6 +58,8 @@ main(int argc, char *argv[])
exit(0);
}
else {
+ fprintf (stderr, "%s: unrecognized argument '%s'\n",
+ progname, argv[i]);
PrintUsage();
}
}