summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-11-26 22:30:18 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-11-26 22:30:18 -0800
commitca6adf351b4fc317c4dfc4c8e723b84fd676d4e2 (patch)
tree735f647b14aaf587f8dabc6334c223209ec836fa
parentb980cacaa342cbbaa3012f06ffc2c9a9c21d33ee (diff)
Print which option was in error along with usage message
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--xdpyinfo.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/xdpyinfo.c b/xdpyinfo.c
index f161a97..84d5b2a 100644
--- a/xdpyinfo.c
+++ b/xdpyinfo.c
@@ -1466,18 +1466,29 @@ main(int argc, char *argv[])
size_t len = strlen(arg);
if (!strncmp("-display", arg, len)) {
- if (++i >= argc) usage ();
+ if (++i >= argc) {
+ fprintf (stderr, "%s: -display requires an argument\n",
+ ProgramName);
+ usage ();
+ }
displayname = argv[i];
} else if (!strncmp("-queryExtensions", arg, len)) {
queryExtensions = True;
} else if (!strncmp("-ext", arg, len)) {
- if (++i >= argc) usage ();
+ if (++i >= argc) {
+ fprintf (stderr, "%s: -ext requires an argument\n",
+ ProgramName);
+ usage ();
+ }
mark_extension_for_printing(argv[i]);
} else if (!strncmp("-version", arg, len)) {
printf("%s\n", PACKAGE_STRING);
exit (0);
- } else
+ } else {
+ fprintf (stderr, "%s: unrecognized argument '%s'\n",
+ ProgramName, arg);
usage ();
+ }
}
dpy = XOpenDisplay (displayname);