diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-11-26 22:30:18 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-11-26 22:30:18 -0800 |
commit | ca6adf351b4fc317c4dfc4c8e723b84fd676d4e2 (patch) | |
tree | 735f647b14aaf587f8dabc6334c223209ec836fa /xdpyinfo.c | |
parent | b980cacaa342cbbaa3012f06ffc2c9a9c21d33ee (diff) |
Print which option was in error along with usage message
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'xdpyinfo.c')
-rw-r--r-- | xdpyinfo.c | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -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); |